Can't say it's the best method but will work
PhoneBooking::latest('date')->latest('time')->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
here is my controller , i want to list the recordes latest first according to the date and time field
public function index()
{
//
if (Auth::check()) {
// $PhoneBookings = PhoneBooking::all();
$PhoneBookings = PhoneBooking::orderBy('date','time', 'DESC')->get();
return view('booking.listBooking', compact('PhoneBookings'));
}
else{
return view('auth.login');
}
}
please advice
Please or to participate in this conversation.