ambengers / laravel-query-filter

Laravel query filter provides an elegant way to filter your eloquent models via the request query string.
MIT License
30 stars 5 forks source link

Does not work on hasManyThrough #16

Closed ambengers closed 2 years ago

ambengers commented 3 years ago

Using example on the Laravel Has Many Through docs

projects id - integer name - string

environments id - integer project_id - integer name - string

deployments id - integer environment_id - integer commit_hash - string

public function index(ProjectFilters $filters) 
{
    $results = $project->deployments()->filter($filters);
    // On the results, the id of environments will override the id of the deployments
}

This is because HasManyThrough class overrides the get() call on the Relation class.

ambengers commented 2 years ago

Tested on 4.7.1.