Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs/4.0/filtering/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,20 @@ This will return all posts that doesn't contain `Some title` substring.

### Match closure

There may be situations when the filter you want to apply not necessarily is a database attributes. In your `booted`
There may be situations when the filter you want to apply is not necessarily a database attribute. In your `booted`
method you can add more filters for the `$match` where the key represents the field used as query param, and value
should be a `Closure` which gets the request and current query `Builder`:

```php
// UserRepository
protected static function booted()
protected static function booted()
{
static::$match['active'] => function ($request, $query) {
if ($request->boolean('active')) {
$query->whereNotNull('email_verified_at');
} else {
$query->whereNull('email_verified_at');
}
}
}
}
```
Expand Down