vendredi 30 novembre 2018

How to change url in pagination?

In my Laravel 5.7 app I have news page

http://mysite/all_news

with pagination implementation as:

$newsList = PageContent
    ::select(\DB::raw(' page_contents.*, users.username'))
    ->getByPageType( 'N' )
    ->getByPublished( true )
    ->orderBy('created_at', 'desc')
    ->join(\DB::raw('users '), \DB::raw('users.id'), '=', \DB::raw('page_contents.creator_id'))
    ->paginate( 4 , null, null, $page)
    ->onEachSide();

and route defined as :

Route::get('all_news', array(
    'as'      => 'all_news',
    'uses'    => 'PageController@all_news'
));

and in view I show pagination :

But rendered links in pagination looks like(and how to render them ?):

http://mysite/all_news?=2

How to make urls look like

http://mysite/all_news/2

?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2QoW2Dq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire