how can I check if the current record is the last one in the model?
$lastorder=Order::find($order_id); if($lastorder->last())
Advertisement
Answer
$orders = Order::where('id','>=', $order_id)->get(); $order = $orders->first(); if($orders->count() > 1) { //... // NOT the last record :( //... } else { //... // Last record :) //... }