Have you added onError() with a callback in the InertiaJS request ?
Problem with Laravel + Inertia when validating request
Hi all, I'm currently working on a project started by someone else which uses Laravel (8.55.33) + Jetstream + Inertia + Vue. I'm currently having an issue when the request fails due to validation.
In the view, the form is created with this.$inertia.form({...}) and submitted with this.form.put()
In the controller I have code like this:
public function update(Request $request, $id)
{
$data = $request->validate([...]);
// actions with $data
return back(303);
}
If the request is valid, everything seems to work fine: I see in the requests tab an HTTP put request with a 303 response which then triggers an additional GET on the resource. However, if the request fails the validation rules, the inertia request get an 409 status code with then redirects the user to the home page. Why is that and how can I solve it?
Please or to participate in this conversation.