could you please help me to achieve laravel pagination with the results of a stored procedure and display them in a view. I have the following code which works fine, but when I click on a page number of the paginate, I redirect to the home page:
$data = DB::select(DB::raw('EXEC CUST_MIS_EMPLEADOS ' . $condicion));
$page = \Illuminate\Support\Facades\Input::get('page', 1);
$paginate = 16;
$offSet = ($page * $paginate) - $paginate;
$itemsForCurrentPage = array_slice($data, $offSet, $paginate, true);
$data = new LengthAwarePaginator($itemsForCurrentPage, count($data), $paginate, $page);
if (count($data) > 0) {
return view('client.activEmployees', compact('data'));
} else {
Session::flash('message', 'No se encontraron resultados sobre la búsqueda');
return view('client.activEmployees', ['message' => 'Si']);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire