Download the PHP package omar-elnaghy/laradate-filters without Composer
On this page you can find all versions of the php package omar-elnaghy/laradate-filters. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download omar-elnaghy/laradate-filters
More information about omar-elnaghy/laradate-filters
Files in omar-elnaghy/laradate-filters
Package laradate-filters
Short Description A Laravel package for advanced date filtering and manipulation
License MIT
Informations about the package laradate-filters
Laravel Date Filtering Package
A Laravel package for advanced date filtering and manipulation
Laravel Date Filtering is a package that simplifies date-based filtering for your Laravel Eloquent models. It provides a set of convenient methods to filter records based on various date and time intervals.
Table of Contents
- Installation
- Usage
- Examples
Installation
You can install the package via Composer:
then publish config file
Usage
Date Filtering Methods: Use the provided methods like FilterByDateRange, FilterByDateHoursRange, FilterByDateMinutesRange, etc., to filter records based on your specific criteria.
Features
Date Range Filtering : You can filter records based on a specified date range, including records created "after" or "before" a certain date and time.
Flexible Time Units : You can filter records using various time units, such as seconds, minutes, hours, days, weeks, or months.
Inclusive or Exclusive Ranges : You can choose whether the date range should be inclusive or exclusive, allowing you to fine-tune your query results.
The key feature
The key feature of this trait is its ability to catch and handle dynamic date filtering methods based on a simple naming convention, making it incredibly convenient and powerful for developers:
Dynamic Date Filtering Magic
Unleash the magic of dynamic date filtering with our BuilderTrait! No more writing tedious, repetitive date filtering methods. With this trait, you can create date filters on the fly by simply following a naming convention.
Effortless Date Filtering
Imagine you want to filter records by date, but you don't want to write separate methods for every possible duration—seconds, minutes, hours, days, weeks, months, and more. Our BuilderTrait has you covered. Just name your method following the pattern "filterByDateXRange," and voila! X can be any duration, and the trait will handle the rest.
Convenient and Flexible
Need to filter records for the last 30 minutes? Call filterByDate30MinutesRange(). Want records from the last week? It's as simple as filterByDate{duration}{unit}Range(). The trait dynamically generates these methods, making your code clean and your life easier.
Examples
1 - Filter by Custom duration and date unit (second,minutes,hours,..)