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

evlonmop's avatar

Flash data missing from request

Hey,

I'm passing flash data to pop an alert in the main view but it's always missing. Strange because i'm using the same system as always.

Tried with:

request()->session()->flash('alert', $alert);
// and
return redirect()->route('rates')->with('alert', $alert);

And in the view:

@if(Request::has('alert'))
// and
@if(request()->session()->has('alert'))

But it keeps returning false

I did some routing modifications and I checked if i was applying web middleware twice but no. It's all correct:

// Provider
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/admin.php'));

// routes files
/**
 * Back Office
 */
Route::group(['namespace' => 'Admin', 'middleware' => ['auth']], function () {
0 likes
5 replies
Cronix's avatar

Is this a regular request, or an ajax request?

Snapey's avatar

Check you don't have two redirects. Look in the browser network tab. You should see one 302 response to your rates page

evlonmop's avatar

@Snapey Yes, only one redirect.

If I debug request() i can find the alert data under request()->session->attributesbut Request::has('alert') is returning false

evlonmop's avatar
evlonmop
OP
Best Answer
Level 1

oh... nevermind. I was using Request::has() instead of Session::has().

1 like

Please or to participate in this conversation.