Answers for "laravel get next and previous record"

PHP
0

laravel get next and previous record

// get next record of current record
$next = Model::select('id AS next')->where('id', '>', /*current_id*/)->min('id');
// get previous record of current record
$previous = Model::select('id as previous')->where('id','<', /*current_id*/)->max('id');
Posted by: Guest on October-22-2021

Code answers related to "laravel get next and previous record"

Browse Popular Code Answers by Language