I\'m making a Laravel Pagination based from my query result and be rendered in my view. I\'m following this guide http://laravel.com/docs/5.1/pagination but I get an error:<
You set it by using the custom pagination..
$query = "Your Query here";
$page = 1;
$perPage = 5;
$query = DB::select($query);
$currentPage = Input::get('page', 1) - 1;
$pagedData = array_slice($query, $currentPage * $perPage, $perPage);
$query = new Paginator($pagedData, count($query), $perPage);
$query->setPath('Your Url');
$this->data['query'] = $query;
return view('Your_view_file', $this->data, compact('query'));
Here you can specify the path by using the setpath()
.
In your View
@foreach($query as $rev)
//Contents
@endforeach
appends($_REQUEST)->render(); ?>
The appends
will append the data.
Thank you.