Support the ongoing development of Laravel.io →
Database
Last updated 1 year ago.
0

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-pag...

0

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-pag...

I don't understand how make a paginator manualy.

Can you show me an exemple?

0

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>
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.