Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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() !!}
Comment

laravel multiple paginate

# use default 'page' for this
$collection1 = Model::paginate(20);

# use custom 'other_page' for this
$collection2 = Model2::paginate(20);
$collection2->setPageName('other_page');
Comment

PREVIOUS NEXT
Code Example
Php :: users not having any role laravel spatie 
Php :: how to assign value of a js variable to a php variable 
Php :: Notice: Undefined variable: _SESSION in C:xampphtdocspracticeheader.php on line 7 
Php :: reset array keys php 
Php :: laravel htaccess 
Php :: wp shortcode 
Php :: laravel where multiple conditions on single colmn 
Php :: boot add schema in laravel 
Php :: get post index wordpress 
Php :: find substring in string php 
Php :: php even odd program 
Php :: laravel carbon 
Php :: laravel find many 
Php :: php postgresql number of rows 
Php :: htmlspecialchars_decode (PHP 5 = 5.1.0, PHP 7, PHP 8) htmlspecialchars_decode — Convert special HTML entities back to characters 
Php :: htmlspecialchars (PHP 4, PHP 5, PHP 7, PHP 8) htmlspecialchars — Convert special characters to HTML entities 
Php :: multiple routes same controller laravel 
Php :: str_replace smarty template 
Php :: file upload in php mysql 
Php :: command to create model with migration in laravel 
Php :: php array flip 
Php :: php replace youtube embed url 
Php :: set postman global variable header 
Php :: heredoc php 
Php :: laravel select multiple value in form edit 
Php :: date time in php 
Php :: get term id by post id 
Php :: call function in php 
Php :: laravel Service Unavailable 
Php :: password change logout from wordpress 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =