Reputation: 314
I need to call $_SESSION
in laravel controller, because I placed laravel in a subfolder of another website so I need to get the session from another website. But because of I call $_SESSION
inside controller, the redirect thing is not working and shown like this when I run php artisan route:list
:
Anyone can help me to call $_SESSION from laravel controller? Thank you.
Upvotes: 0
Views: 304
Reputation: 101
For Session's in Laravel you can refer https://laravel.com/docs/5.4/session
Upvotes: 1
Reputation: 578
That's Wrong
Please Do like this
Controller or model or route
Anywhere
use Session;
$request->session()->put('`key`', 'value');
use Illuminate\Support\Facades\Session;
if (session('id') != null){
echo 'Success'
}
Or use the session() helper:
For Your Reference https://laravel.com/docs/5.1/session
Upvotes: 1