How to get last N entries from DB | Laravel

Created At: 2020-11-10 18:09:30 Updated At: 2021-03-12 22:34:28

To get the first or last 10 entries from laravel eloquent model you can like this. 

Example code

Model::orderBy('id', 'desc')->take(10)->get();

Get any last 10 entries 


To get the latest post or recent post 

Model::orderBy('id', 'desc')->limit(10)->get();




Add Reviews