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

AO's avatar
Level 1

session flash not working

Hello.

I'm trying to flash a message after user registration.

I copied the registered method and paste it in RegisterController :

    protected function registered(Request $request, $user)
    {

      session()->flash('points','You have 5 points !');

    }

I'm not getting anything when dd(session()->all()).

it works only when I use Session::put() .

I'm calling the session in my view like this :

@if(session('points'))
    <script>
        Swal.fire({
            title: '{{session('points')}}',
            text: '{{auth()->user()->badges->first()->description}}',
        })
    </script>
@endif

I upgraded from Laravel's5.8 to 6.

I did test the session in other controllers which are working fine.

can't figure this out :\ any idea what's going on?

0 likes
3 replies
lightyagami's avatar
$request->session()->flash('status', 'Task was successful!');
1 like
lightyagami's avatar
protected function registered(Request $request, $user)
{
     $request->session()->flash('points','You have 5 points !');
}
1 like
Sinnbeck's avatar

Where do you redirect to after registering? Is it perhaps not the same page as you expect the flash to be used?

1 like

Please or to participate in this conversation.