you cant call paginate on a db query. refer to this for manually creating a paginator. http://laravel.com/docs/5.1/pagination#manually-creating-a-paginator
astroanu said:
you cant call paginate on a db query. refer to this for manually creating a paginator. http://laravel.com/docs/5.1/pagination#manually-creating-a-paginator
I don't understand how make a paginator manualy.
Can you show me an exemple?
Hello caioregatieri...
note controller below CarsController.php
use app\Cars;
public function list()
{
$cars = Cars::paginate(10);
return view('cars.list', compact('cars'))->withCars($cars);
}
in you view:
<span class="pagination"> {!! $cars->appends(['search' => Input::get('search')])->render() !!} </span>
'search' is a name of your input.
<!--Search Form-->
<form method="GET">
<div class="input-group">
<div class="input-group">
<input type="text" class="form-control" name="search" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</div>
</form>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community