Answers for "use multiple pagination in same page laravel"

PHP
0

use multiple pagination in same page laravel

// in controller 
$newEvents = Events::where('event_date', '>=', Carbon::now()->startOfDay())
    ->orderBy('event_date')
    ->paginate(15,['*'], 'newEvents');

$oldEvents = Events::where('event_date', '<', Carbon::now()->startOfDay())
    ->orderBy('event_date', 'desc')
    ->paginate(15,['*'], 'oldEvents');

//use in view
    
// some code to display $newEvents
{!! $newEvents->render() !!}

// some code to display $oldEvents
{!! $oldEvents->render() !!}
Posted by: Guest on October-08-2021

Code answers related to "use multiple pagination in same page laravel"

Browse Popular Code Answers by Language