Kyslik / column-sortable

Package for handling column sorting in Laravel 5/6/7/8
MIT License
641 stars 105 forks source link

problem with pagination design #175

Closed johbuch closed 3 years ago

johbuch commented 3 years ago

Hello,

I encountered a problem with the pagination. I have this method in my controller

    public function browse()
    {
        // récupération de toutes les annonces en BDD, avec un tri et pagination
        // du paquet Kyslik/column-sortable
        $annonces = Annonce::sortable('id')->paginate(5);

        return view('admin.annonce.browse', compact('annonces'));
    }

Then i have my model

public $sortable = [
        'id',
        'ref_annonce',
        'prix_annonce',
        'surface_habitable',
        'nombre_de_piece',
        'created_at',
        'updated_at',
    ];

On my blade template I have this

<div class="text-center">
        {!! $annonces->appends(\Request::except('page'))->render() !!}
        </div>

Then on my view, i've got a problem with pagination. cf screenshot image

I use laravel 8, bootstrap 4 and i have followed you tutorial. I did not find how to solve this, can you help me please ?

johbuch commented 3 years ago

So i have found a solution for my problem here it is

In app/Providers/AppServiceProvider.php, i added the use statement use Illuminate\Pagination\Paginator; then in the boot function, i added Paginator::useBootstrap();

much better image

Sorry, the issue was maybe not due to your package ;)