livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
339 stars 19 forks source link

[1.x] Allows to specify rules as closure #71

Closed nunomaduro closed 10 months ago

nunomaduro commented 10 months ago

Fixes: https://github.com/livewire/volt/pull/67. Test suite failing because of: https://github.com/livewire/volt/pull/70.

This pull request fixes an issue with the rules function where is not possible to defer the rules resolution like so:

rules(fn () => [
    'name' => ['required', 'min:6'],
    'email' => ['required', 'email', 'not_in:'.Auth::user()->email]
]);