I\'m trying to get a success message back to my home page on laravel.
return redirect()->back()->withSuccess(\'IT WORKS!\');
For some
One way to do that is sending the message in the session like this:
Controller:
return redirect()->back()->with('success', 'IT WORKS!');
View:
@if (session()->has('success'))
{{ session('success') }}
@endif
And other way to do that is just creating the session and put the text in the view directly:
Controller:
return redirect()->back()->with('success', true);
View:
@if (session()->has('success'))
IT WORKS!
@endif
You can check the full documentation here: Redirecting With Flashed Session Data
I hope it is very helpful, regards.