Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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');
 
PREVIOUS NEXT
Tagged: #laravel #previous #record
ADD COMMENT
Topic
Name
8+8 =