lacodix/laravel-model-filter
Filter, search, and sort Eloquent models with reusable filter classes and query-string support. Includes built-in types (string, date, number, enum), relation/nested relation filtering, custom complex logic, and filter visualisation.
Architecture Fit
The laravel-model-filter package (v4.4.1) extends Laravel’s query filtering capabilities with a new BelongsToManyTimeframe feature, enabling granular time-based filtering for polymorphic/many-to-many relationships. This aligns well with Laravel’s Eloquent ecosystem and is particularly valuable for applications requiring temporal data segmentation (e.g., analytics, reporting, or audit logs). The feature is modular and non-intrusive, fitting seamlessly into existing query builders without requiring architectural overhauls.
Integration Feasibility
Integration is straightforward for Laravel applications already using Eloquent or the package’s core filtering system. The new timeframefilter modes (e.g., created_at, updated_at, or custom timestamps) can be retrofitted into existing BelongsToMany relationships with minimal code changes. Compatibility is maintained with Laravel 8+ and PHP 8.0+, ensuring no major version conflicts.
Technical Risk
BelongsToMany pivot tables may require explicit configuration.whereHas with timeframe filters).illuminate/database) match your Laravel version.Key Questions
BelongsToMany relationships with temporal data (e.g., tracking record creation/modification)?Stack Fit
Migration Path
BelongsToMany relationships with temporal attributes (e.g., created_at in pivot tables).composer require lacodix/laravel-model-filter:^4.4.1).timeframefilter modes:
$query->filter(['timeframe' => ['mode' => 'created_at', 'range' => '2024-01-01..2024-03-31']]);
Compatibility
Sequencing Prioritize integration for:
created_at/updated_at in pivot tables.Maintenance
timeframefilter enhancements or bug fixes. The package’s active maintenance (GitHub activity) reduces long-term risk.Support
DB::enableQueryLog()) to inspect generated SQL for timeframe filters.Scaling
created_at in pivot tables).Failure Modes
Carbon macros).Ramp-Up
timeframefilter modes.How can I help you explore Laravel packages today?