Summer Sale! All accounts are 50% off this week.

yusuf128's avatar

Session issue

i m checking that session is exist or not like

if (Session::has('guest_user_chat_ids'))
        {
            echo 'if -----'.Session::get('guest_user_chat_ids');
        }
else
        {
            Session::put('guest_user_chat_ids', 'yusuf');
            echo 'else ==== '.Session::get('guest_user_chat_ids');
        }
        exit;

but always output of else part like "else ==== yusuf";

0 likes
4 replies
Snapey's avatar

Please format your code by putting 3 backticks ``` on a line before and after each code block

1 like
Snapey's avatar
Snapey
Best Answer
Level 122

if you use exit then anything you write to session will be lost because the terminable middleware does not run and it is there where the session data is persisted.

Just use a return instead

Please or to participate in this conversation.