How To Get Second Last Record In Laravel

Hello Artisan

In this tutorial i will show you how to get second last row record in laravel. Sometimes we need to be printed second last record in laravel. Do you know how to get or how to write the query of second last record. 

If you don't know then this tutorial is for you. Let's see how to get second last row in laravel.

Example Code

\App\Customer::orderBy('created_at', 'desc')->skip(1)->first();


Recommended : How to Get Last Row of Database Table in Laravel


Hope it can help you.


#laravel #laravel-7 #eloquent-tips