AO
3 months ago
325
3
Laravel

session flash not working

Posted 3 months ago by AO

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?

Please sign in or create an account to participate in this conversation.