0

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:

enter image description here

Anyone can help me to call $_SESSION from laravel controller? Thank you.

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

For Session's in Laravel you can refer https://laravel.com/docs/5.4/session

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.