How tucker-eric/eloquentfilter works
Main Components
a. Core Components:
• Filterable Trait (src/Filterable.php)
• ModelFilter Base Class (src/ModelFilter.php)
• Service Providers (for Laravel and Lumen)
• Command Generator (MakeEloquentFilter)
b. Integration Points:
• Laravel/Lumen Framework
• Eloquent ORM
• User's Application Models
• User's Model Filters
┌─ Application Layer ─────────────────────┐
• User's Laravel/Lumen Application │
• ┌─ Models ──────┐ ┌─ Model Filters ─┐ │
• User Model │──│ UserFilter │ │
• Client Model │──│ ClientFilter │ │
• ┘ └────────────────┘ │
• ┼───────────────┼───────────┤
• ▼ ▼ │
• ┌─ Eloquent Filter Package ──────────┐│
• ┌─ Filterable Trait ────────────┐ ││
• filter() │ ││
• paginateFilter() │ ││
• provideFilter() │ ││
• ┘ ││
• ▼ ││
• ┌─ ModelFilter Base Class ────┐ ││
• setup() │ ││
• related() │ ││
• input handling │ ││
• relationship filtering │ ││
• ┘ ││
• ┼─────────────────────┘│
• ▼ │
• ┌─ Laravel/Lumen Integration ──────┐ │
• ServiceProvider │ │
• Commands │ │
• ┘ │
• ┘
Important Relationships
a. Data Flow:
• Request Input → Model::filter() → ModelFilter → Query Builder
• Relationship between Models and their respective Filters
b. Inheritance/Implementation:
• Models implementing Filterable trait
• Custom Filters extending ModelFilter base class
Additional Elements
• Different component types
b. Notes section highlighting:
• Configuration options
• Key features (relationship filtering, dynamic filters)
• Integration points
Implementation Details
• The package's role as a bridge between user input and Eloquent queries
• How the Filterable trait connects user models to the filtering system
• The relationship handling capabilities
• Service provider integration with Laravel/Lumen