This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Allow to omit return in callback of Query Builder when() #233
Comments
For instance query scopes: https://laravel.com/docs/5.3/eloquent#query-scopes and almost every method on the collections: https://laravel.com/docs/5.3/collections#method-map |
I think Collection methods are really a different case, where About scopes:
|
See also the code in this recent tweet: https://twitter.com/taylorotwell/status/784407839162851328 $validator = Validator::make(['name' => 'Taylor Otwell'], [
'name' => [
Rule::unique('users')->ignore(2)->using(function ($query) {
$query->whereIn('foo', [1, 2, 3]);
})
],
]); edit: above new validation syntax has been implemented: laravel/framework#15809 |
Implemented in Laravel 5.4.16, by laravel/framework#18422. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think laravel/framework#13091 should be reconsidered. Here is an example use case:
The "when" part isn't very sexy…, removing the
return
makes it a bit better:when()
implementation is very simple.The text was updated successfully, but these errors were encountered: