How To Get Last N Days Records In Laravel

Hello Artisan

In this tutorial i am going share with you that how to get last 7 days record in laravel? Actually it's not last 7 days, it should be last N days records. If you know this query then you can fetch any data between two dates. See the example code of how to get last one month data in laravel from below example.

You can also learn how to get last one month data in laravel from this tutorial. Sometimes in our Laravel application we need to show Last N days records like last 7 days records, last 30 days record or last days record. You will learn all of them from this tutorial.

Example code : 

\App\Model::whereBetween('date', [


Read also : How to Use groupBy() having() and havingRaw() with DB::raw in Laravel ?


Hope this fetching data using laravel date tutorial will help you.


#laravel #eloquent-tips