Я пытаюсь реализовать интеллектуальную поисковую систему для своего приложения Laravel 5.2. Вот учебник Laravel 4 и я хочу реализовать в Laravel 5:Class 'Input' not found
https://maxoffsky.com/code-blog/laravel-shop-tutorial-3-implementing-smart-search/
, но я застрял в ApiSearchController, и я получаю:
Class 'Input' not found
Вот мой контроллер
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Input;
use App\Http\Requests;
class ApiSearchController extends Controller
{
public function index()
{
$query = e(Input::get('q',''));
if(!$query && $query == '') return Response::json(array(), 400);
$products = Product::where('published', true)
->where('name','like','%'.$query.'%')
->orderBy('name','asc')
->take(5)
->get(array('slug','name','icon'))->toArray();
$categories = Category::where('name','like','%'.$query.'%')
->has('products')
->take(5)
->get(array('slug', 'name'))
->toArray();
// Data normalization
$categories = $this->appendValue($categories, url('img/icons/category-icon.png'),'icon');
$products = $this->appendURL($products, 'products');
$categories = $this->appendURL($categories, 'categories');
// Add type of data to each item of each set of results
$products = $this->appendValue($products, 'product', 'class');
$categories = $this->appendValue($categories, 'category', 'class');
// Merge all data into one array
$data = array_merge($products, $categories);
return Response::json(array(
'data'=>$data
));
}
}