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

visualight's avatar

Laravel Session : check if not exist

Hello,

I try to detremine if a session in laravel not exist. I do the following request but it doesn't work :

''' if(!Session::has('location')){ ... } '''

How i can check if a laravel session (session::put) is not set ? Thank you

0 likes
2 replies
d3xt3r's avatar
d3xt3r
Best Answer
Level 29

This should work, but only on routes for which session is initialised.

visualight's avatar

Yes of course i use sublimetext and o forgot to init Session in my controller (but i never get errors).

Please or to participate in this conversation.