File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -137,20 +137,20 @@ This will return all posts that doesn't contain `Some title` substring.
137137
138138### Match closure
139139
140- There may be situations when the filter you want to apply not necessarily is a database attributes . In your ` booted `
140+ There may be situations when the filter you want to apply is not necessarily a database attribute . In your ` booted `
141141method you can add more filters for the ` $match ` where the key represents the field used as query param, and value
142142should be a ` Closure ` which gets the request and current query ` Builder ` :
143143
144144``` php
145145// UserRepository
146- protected static function booted()
146+ protected static function booted()
147147{
148148 static::$match['active'] => function ($request, $query) {
149149 if ($request->boolean('active')) {
150150 $query->whereNotNull('email_verified_at');
151151 } else {
152152 $query->whereNull('email_verified_at');
153- }
153+ }
154154 }
155155}
156156```
You can’t perform that action at this time.
0 commit comments