Laravel 6 , PHP , Laravel
In this example, I will show you how to get last record from database in Laravel 6 with example. you can simply get last record using laravel 6 eloquent model.
There are several way to get last record from table in Laravel 6.
In PHP, you normally use order by clause with descending order to get last one record from database table and same you can do in laravel but laravel has some awesome method to interact with database table.
You can use latest method to get last record from database table in Laravel application.
$lastRecord = User::latest()->first();
$lastRecord = User::orderBy('id', 'DESC')->first();
It will help you....