I want use session in Laravel like $_SESSION['test'] in a normal PHP. I tried this in Laravel,but the data will be not stored when i use the session in another Controller
// User CONTROLLER
class UserController extends Controller
{
public function testSession(Request $request)
{
// ...
Session::set( 'id','1' );
$request->session()->put('username', 'simo');
}
}
Another CONTROLLER
class AnotherController extends Controller
{
public function GetMySession(Request $request)
{
// ...
dd($request->session()->all());//
}
}
Now username and id are not stored in the Session why ??
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire