It's very important to have access to HTTP session in our Laravel Controller or Service class. Below is a code sample of session access in Controller class. Use of session in Service is similar.
<?php namespace App\Http\Controllers; use Symfony\Component\HttpFoundation\Session\Session; class HomeController extends BaseController { private $Session; public function __construct(Session $Session) { $this->Session = $Session; } public function setSessionValue() { $this->Session->set("some_name", "some_value_in_session"); exit; } public function getSessionValue() { echo $this->Session->get("some_name"); die(); }