At first.
I saw this questions: Laravel 5 - session put not working Laravel session key is null after put in session laravel session returning null inspite of setting it Laravel 5 - session doesn't work
Trying to modify my code but nothing changed.
Problem:
On http://localhost:8000/session/set
- trying to save the session (var_dump returning NULL)
On http://localhost:8000/session/get
- trying to get this session which i saved but it doesn't.
My code in SessionController.php
:
class SessionController extends Controller{
public function accessSessionData(Request $request){
if($request->session()->has('name')){
var_dump($request->session()->get('name'));
}
else{
echo 'No data in the session.';
}
}
public function storeSessionData(Request $request){
var_dump($Crequest->session()->put('name','Filip'));
echo "Data has been set.";
}
}
My code in route.php
:
Route::get('session/get', 'SessionController@accessSessionData');
Route::get('session/set', 'SessionController@storeSessionData');
Route::get('session/delete', 'SessionController@deleteSessionData');
In session.php
driver set to file
with standard storage_path
.
Folder which storage sessions - chmod 755
Any ideas ?