Session values from livewire component

What seems to be the problem:

Session values are not persisting in Laravel controller

Steps to Reproduce:

This is the method called in my Livewire component.

public function startTraining()
{
    Session::put('some_key', 'golden');

    return redirect()->route('review');
}

This method in my Laravel Controller returns null.

public function review( Request $request )
{
    $data = $request->session()->get('some_key');

    dd($data);
}

Any explanation?

Dan

I have the same behavior.
I checked my Livewire endpoint middleware. “web”-middleware was set, so CreateSession included.

I assume it was a Livewire update last days, because my code like yours above worked for some time.

Now I use session()->flash('some_key', $value); and it works.

Maybe we have an answer for this here: https://github.com/livewire/livewire/discussions/3099

I will try $this->redirect('route')

Thanks for the info. I will check it out.

Yes, that fixed the issue. Thanks. I did an update and it fixed another weird issue where the user was being swapped on that redirect. Glad that one cleared up.