Search
 
SCRIPT & CODE EXAMPLE
 

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');
Comment

PREVIOUS NEXT
Code Example
Php :: how to get full path of uploaded file in php 
Php :: get ids from object 
Php :: Laravel catch TokenMismatchException 
Php :: what are the different types of PHP variables? 
Php :: laravel set timezone dynamically 
Php :: optional parameter in laravel 
Php :: laravel where json array column 
Php :: laravel many to many relationship 
Php :: test_input php 
Php :: if user not signed in redirected to login laravel from route 
Php :: wordpress access database php 
Php :: magento check which user has added a product 
Php :: how to create module in laravel 
Php :: send email verification nootification laravel 
Php :: laravel dependency injection 
Php :: laravel send mail using outlook 
Php :: how to create resource in laravel 
Php :: controller class does not exist laravel 
Php :: Laravel render stuff in a given environment 
Php :: if else php 
Php :: php array_map 
Php :: check if is the last day of the month php 
Php :: adminlte con laravel 8 
Php :: split functions.php 
Php :: placeholder for select php 
Php :: download file from s3 using laravel 
Php :: laravel collection zip 
Php :: php radian to cosine 
Php :: how to alter table stracture in sql using php 
Php :: how to select max write textarea value in php 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =