Reputation: 123
The redirect url is working well but the message is not showing.It looks with method is not working.
Controller
return redirect('/Patient_Home')->with(['payment_success','Payment has been completed successfully']);
view
@if(Session::has('payment_success'))
<div class="alert alert-success" style="text-align:center">
{{Session::get('payment_success')}}
</div>
@endif
Upvotes: 0
Views: 62
Reputation: 975
Should be:
return redirect()->route('your patient home route')->with('payment_success','Payment has been completed successfully');
On blade view, try this:
@if ($message = Session::get('payment_success'))
{{ $message }}
@endif
Also, run this command to clear caches:
php artisan optimize:clear
Regards
Upvotes: 3
Reputation:
You have created a RedirectResponse instance to flash data to the session in a single method chain. This is also works for storing status messages after an action:
return redirect('/Patient_Home')->with(['payment_success','Payment has been completed successfully']);
@if (session('payment_success'))
<div class="alert alert-success">
{{ session('payment_success') }}
</div>
@endif
Upvotes: 0