📌  相关文章
📜  laravel 获取下一条和上一条记录 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:57.881000             🧑  作者: Mango

代码示例1
// 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');