Answer the question
In order to leave comments, you need to log in
How to return newly created post back to inertiajs template?
There is a record creation form. I send the form to the back using this.$inertia.METHOD. The record is created and needs to be returned back to the page with the form using inertia. redirect()->back()->with() doesn't work.
Answer the question
In order to leave comments, you need to log in
No way.
Inertia is not an API, but a monolith. When you submit a form (or make an inertia request via $inertia.visit, $inertia.get, $inertia.post, etc.), then Inertia expects an InertiaResponse or RedirectResponse as a response, but an array of data.
Those. in inertia in the controller, you only redirect back through back(), or return the correct response
return inertia()->render('Some/Component', ['some' => 'data'])
form.reset()
. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question