php - method - No se encontrĂ³ la clase ''Illuminate / Support / Facades / Paginator''
paginacion laravel (2)
Cambie su código use Illuminate/Support/Facades/Paginator
para Illuminate/Pagination/Paginator
Y con suerte, funcionará.
Aquí está mi código:
namespace App/Http/Controllers;
use Illuminate/Support/Facades/DB;
use Illuminate/Support/Facades/Paginator;
use Illuminate/Support/Facades/Input;
use Illuminate/Http/Request;
use App/Http/Requests;
use App/news;
use App/productions;
class SearchController extends Controller
{
public function index(Request $request){
$q = $request->q;
$page = Input::get(''page'', 1);
$paginate = 5;
$first = DB::table(''news'')
->select([''id'', ''title'', ''description'', ''imgPath''])
->where(function($query) use ($q) {
$query->where(''title'', ''like'', "%$q")
->orWhere(''description'', ''like'', "%$q");
});
$result = DB::table(''productions'')
->select([''id'', ''title'', ''description'', ''imgPath''])
->where(function($query) use ($q) {
$query->where(''title'', ''like'', "%$q")
->orWhere(''description'', ''like'', "%$q");
})
->unionAll($first)
->get();
$slice = array_slice($result, $paginate * ($page - 1), $paginate);
$results = Paginator::make($slice, count($result), $paginate);
return view(''search'', compact(''results''));
}
}
Cuando lo ejecuto, arroja este error:
No se encontró la clase ''Illuminate / Support / Facades / Paginator''
Nota: uso Laravel Framework versión 5.2.45 .
¿Cómo puedo arreglarlo?
Intenta cambiarlo a:
$results = new /Illuminate/Pagination/Paginator($parameters);