Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ecwebservices's avatar

Laravel Spark Form return success how to?

So I'm not to new to Laravel, as I've been using it with almost no issues for 4-5 months, but I've started using Spark (and Vue) but maybe 2 weeks ago. With the form documentation being very small, I've had a problem trying to figure out how to send a success message from my controller to my form. I'm using SparkForms just like how the documentation had showed me, with a few extra parts I needed for my form.

I've tried things like:

return 'success';

and many other responses, but I haven't found the right way to make this work. What am I doing incorrect?

0 likes
5 replies
automica's avatar

@ecwebservices you probably want to send HTTP response 200

something like:

response()->json(['success' => 'success'], 200);
automica's avatar

@ecwebservices looks like the vue component is just expecting a normal response from your controller. I know I didn't include it in my previous snippet, but you did at the return before? so

return response()->json(['success' => 'success'], 200);

Please or to participate in this conversation.