Describe the bug
Basically if we want to implement client-side validation we can do like Aire::open()->rules('key value of rules') or via blade component like <x-aire::form :rules="$rules"/>. Unfortunately, it didn't work as expected when I use blade component. I got an error Cannot unpack array with string keys.
My solutions are:
- Use
{{Aire::open()->rules($rules)}}
- If we wanna use the blade component, make sure that we wrap the
$rules with an array bracket ([$rules]). e.g: <x-aire::form :rules="[$rules]" />
My $rules variable:
$rules = [
'full_name' => 'required|string'
];
Have you published the Aire config file?
No
Have you added custom Aire views?
No
What version does this affect?
- Laravel Version: 8.77.1
- Aire Version: 2.4
To Reproduce
Steps to reproduce the behavior:
- Create a blade view. Let's name it as
form.blade.php.
- Edit
form.blade.php with content below:
<x-aire::form :rules="$rules">
<x-aire::input name="full_name" />
</x-aire::form>
- Create a new route in
web.php. Route::view('/test', 'form');
- Visit
/test/ and see the error.
Expected behavior
I expect the same result as I use Aire::form()->rules($rules) and <x-aire::form :rules="$rules"/>.
Additional context
OOC. How do I manually trigger the client-side validation? Like Aire.validate(). I tried the client-side validation but it didn't work.
Thank you for this package. I ❤️ it.
Describe the bug
Basically if we want to implement client-side validation we can do like
Aire::open()->rules('key value of rules')or via blade component like<x-aire::form :rules="$rules"/>. Unfortunately, it didn't work as expected when I use blade component. I got an error Cannot unpack array with string keys.My solutions are:
{{Aire::open()->rules($rules)}}$ruleswith an array bracket ([$rules]). e.g:<x-aire::form :rules="[$rules]" />My
$rulesvariable:Have you published the Aire config file?
No
Have you added custom Aire views?
No
What version does this affect?
To Reproduce
Steps to reproduce the behavior:
form.blade.php.form.blade.phpwith content below:web.php.Route::view('/test', 'form');/test/and see the error.Expected behavior
I expect the same result as I use
Aire::form()->rules($rules)and<x-aire::form :rules="$rules"/>.Additional context
OOC. How do I manually trigger the client-side validation? Like
Aire.validate(). I tried the client-side validation but it didn't work.Thank you for this package. I ❤️ it.