I have table of dogs in my DB and I want to retrieve N latest added dogs.
N latest added dogs
Only way that I found is something like this:
Do
You may try something like this:
$dogs = Dogs::orderBy('id', 'desc')->take(5)->get();
Use orderBy with Descending order and take the first n numbers of records.
orderBy
Descending
n