I encounter issues with the database driver in order to store sessions cookies:
The database connection is currently working but cookies are not set in the browser however session data are in my database.
I have run:
php artisan session:table
Set database session in my .env
file:
SESSION_DRIVER=database
Bellow the config/session.php
file:
[
'driver' => env('SESSION_DRIVER', 'file'),
'connection' => 'mysql',
'table' => 'sessions',
]
EDIT 1:
The route in web.php
:
Route::group(['domain' => GetDomainInfo::GetDomainName(), 'middleware' => 'web'], function () {
Route::get('/', "HomeController@index");
});
Solved issue by :
I have created for example a localhost domain: webcv by adding to my hosts
file:
127.0.0.1 webcv.local
127.0.0.1 admin.webcv.local
Set the session domain to : .webcv.local in config/session.php like so:
'domain' => env('SESSION_DOMAIN', ".webcv.local"),
Or just by adding in the .env
file:
SESSION_DOMAIN=.webcv.local
Now I can access to both webcv.local
and admin.webcv.local
with the same cookie.
php artisan session:table
composer dump-autoload
php artisan migrate
- RïshïKêsh Kümar