Laravel Date Filtering is a package that simplifies date-based filtering for your Laravel Eloquent models. Date Filtering Methods: Use the provided methods like FilterByDateRange, FilterByDateHoursRange, FilterByDateMinutesRange, etc., to filter records based on your specific criteria.
$startDate = Carbon::parse('2023-9-03'); $range = \OmarElnaghy\LaraDateFilters\Enums\DateRange::INCLUSIVE; $direction = 'after'; $results = Post::filterByDateRange(2,'day',$startDate, $direction, $range)->get(); Flexible Time Units: You can filter records using various time units, such as seconds, minutes, hours, days, weeks, or months. $results = Post::filterByDateRange(2,'day',$startDate, $direction, $range)->get(); $results = Post::filterByDateRange(2,'week',$startDate, $direction, $range)->get(); $results = Post::filterByDateRange(2,'hour',$startDate, $direction, $range)->get(); Inclusive or Exclusive Ranges: You can choose whether the date range should be inclusive or exclusive, allowing you to fine-tune your query results.