#Livewire form submit method?
14 messages · Page 1 of 1 (latest)
Yes! You can have a livewire component for the login and register routes.
You can easily use the Auth facade to process the form input and make the login request, all within the same component
You can then use livewire full page components :
https://livewire.laravel.com/docs/components#full-page-components
Hope this serves you!
Have a great day 🙂
Thank you very much, appreciate it!
One more thing came up, should I move it to a new thread?
My livewire component has this rules() method, with the one for tenants being a function from a validation in laravel.
public function rules(): array {
return [
'email' => ['required', 'string'],
'password' => ['required', 'string'],
'tenant' => [
'required',
'string',
'exists:tenants,id',
function ($attribute, $value, $fail) { ... }
];
}
Do rules like that work for liveview? It seems they don't, the function doesn't seem to run.
Yes they do, however the syntax is slightly different
You can either validate it in your method or you could create a custom validation rule in laravel and use that one, this is the recommended approach I would say
php artisan make:rule ValidTenant
You can create the validation you want there
Then use it like this