composer require tobymaxham/laravel-datetime-scopes
use TobyMaxham\LaravelDateTimeScopes\DateTimeScopes;
class Invoice extends Model
{
use DateTimeScopes;
}
// samples.php
Invoice::ofYesterday(); // query invoices created yesterday
Invoice::ofLastWeek(); // query invoices created in the last week
Invoice::ofLastMonth(); // query invoices created in the last month
Invoice::ofLastQuarter(); // query invoices created in the last quarter
Invoice::ofLastYear(); // query invoices created in the last year
Also there are the methods ofLastMinutes
and ofLastHour
you could use to fetch entries that are created in the last minute/hour.
If you've found a bug regarding security please mail git@maxham.de instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.