I believe you need to store as a string so session()->put('can_visit', 'true')
Sep 25, 2017
4
Level 33
Laravel ajax call set session variable correctly
Hi,
Through an ajax call with axios I set a session variable in Laravel 5.5:
session()->put('can_visit', true);
However when I check in a next get request (not with ajax) if that variable exists:
return session()->has('can_visit');
Result is always false why is that? Is there a better way?
Thx
Please or to participate in this conversation.