prajakta prajakta - 5 months ago 10
PHP Question

Sucess message is not getting displayed in laravel

I want to show a success message once the email is sent after redirected to same page. Here is my code :

return redirect('currentshowreport?showid='.$show_id)->with('success','Email sent successfully');


I am getting redirected to the specified page but the success message is not getting displayed. How to achieve this?

Answer

Try this:

@if (session('success'))
    <div class="alert alert-success">
        {{ session('success') }}
    </div>
@endif