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

bottelet's avatar

Possible to send Flash Session from view to Controller?

Hello

So i want to clear a notification when someone clicks on it in the view, but i somehow need to send which ID the notification is, to the controller, i was thinking if it was possible to generate a flash session in the view, and then retrive it in the Controller? I dont wanna do it in the url, because that would be to easy to manipulate all the other notifications.

For example:

 <a href="{{ url($notify->url, [Session::flash('test', $notifty->id)])) }}"> <h4 class="item-title">{{$notify->text}} </h4></a>

or

{{ url($notify->url)->with(Session::flash('test', $notifty->id)) }}"

Anything like this possible?

0 likes
2 replies
martinbean's avatar

@cawex Just do an AJAX request with the notification’s ID. You should have authorisation preventing users from dismissing other users’ notifications. As this is updating a notification resource, you should also be performing it as either a POST or PUT rather than a GET request.

bottelet's avatar

@martinbean Ah Ofc, don't knwo why i dind't think of that, probably because my Ajax experince is very limited :) I'll look into it thank you!

Please or to participate in this conversation.