aymanalhattami/filament-date-scopes-filter
Pros:
laravel-date-scopes, a battle-tested package for date-based query filtering. This ensures consistency with Laravel’s Eloquent query builder.Cons:
laravel-date-scopes: Requires models to be pre-configured with date scopes (e.g., HasDateScopes trait). This adds a pre-integration step for models not already using this package.DATE, DATETIME, or TIMESTAMP columns (MySQL, PostgreSQL, SQLite, etc.).created_at).laravel-date-scopes. Otherwise, requires adding the trait to models.table() definitions in Filament resources/pages.| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Dependency Bloat | Adds laravel-date-scopes as a transitive dependency (~50KB). |
Acceptable for most projects; minimal overhead. |
| Query Performance | Complex scopes (e.g., decades) may generate slow queries without indexes. | Profile queries with DB::enableQueryLog(); add indexes to date columns. |
| Filament Version Lock | Tied to Filament’s release cycle. | Monitor Filament updates; test package compatibility early. |
| Localization Gaps | Only Arabic translations provided out-of-the-box. | Extend translations via vendor:publish or community contributions. |
| Customization Limits | UI is not fully themeable without overriding Filament components. | Use Filament’s modify methods or CSS to adapt appearance. |
laravel-date-scopes? If not, what’s the effort to migrate them?laravel-date-scopes trait (minimal overhead).spatie/laravel-filament-tables lacks date-scopes).laravel-date-scopes and configure models:
composer require laracraft/laravel-date-scopes
Add HasDateScopes trait to models:
use Laracraft\DateScopes\HasDateScopes;
class Order extends Model { use HasDateScopes; }
composer require aymanalhattami/filament-date-scopes-filter
table() method:
use AymanAlhattami\FilamentDateScopesFilter\DateScopeFilter;
public static function table(Table $table): Table {
return $table->filters([
DateScopeFilter::make('created_at'),
]);
}
php artisan vendor:publish --tag="filament-date-scopes-filter-translations"
DateScopeFilter::make('created_at')->withoutDecades()->withoutCenturies()
| Component | Compatibility Status | Notes |
|---|---|---|
| Filament v3 | ✅ Supported | Tested in changelog (v2.0.0). |
| Filament v4 | ✅ Supported | Explicitly added in PR #16. |
| Filament v5 | ✅ Supported (v2.0.1+) | Requires v2.0.1+ for full compatibility. |
| PHP 8.1–8.3 | ⚠️ May work | Not officially tested; use at own risk. |
| PHP 8.4/8.5 | ✅ Supported | Confirmed in v2.0.1. |
| MySQL/PostgreSQL | ✅ Supported | Standard SQL date functions used. |
| SQLite | ✅ Supported | No database-specific logic. |
| Custom Date Columns | ✅ Supported (with trait) | Any column with DATE/DATETIME type works if model uses HasDateScopes. |
HasDateScopes to target models (if not already present).DB::enableQueryLog().laravel-date-scopes and Filament for breaking changes.How can I help you explore Laravel packages today?