Support the ongoing development of Laravel.io →
posted 7 years ago
Session
Last updated 2 years ago.
0

Can you please place some of your session code here?

0

Ok, so the simplest example would be the middleware that handles my locale:

if(Session::get('lang'))
{
	App::setLocale(Session::get('lang'));
}
else
{
	Session::put('lang', App::getLocale());
}

My session.php is very basic:

return [
	'driver' => env('SESSION_DRIVER', 'file'),
	'lifetime' => 120,
	'expire_on_close' => false,
	'encrypt' => false,
	'files' => storage_path().'/framework/sessions',
	'connection' => 'pgsql',
	'table' => 'sessions',
	'lottery' => [2, 100],
	'cookie' => 'katalog_session',
	'path' => '/',
	'domain' => null,
	'secure' => false,
];

As I said, if I set my session driver to file everything works perfectly. But if I set it to database I get errors as I described. Everything else is db is working just fine. I can read and write data no problem. Only accessing session table doesn't work :/

Tnx, Zvone

0

Btw, here is my log:

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42703]: Undefined column: 7 ERROR:  column "user_id" of relation "sessions" does not exist
LINE 1: ...sert into "sessions" ("payload", "last_activity", "user_id",...
                                                             ^ (SQL: insert into "sessions" ("payload", "last_activity", "user_id", "ip_address", "user_agent", "id") values (YTo2OntzOjY6Il90b2tlbiI7czo0MDoiMkhtc2lPMHk1N2JlUG9nMnpkMWNlNGliSEhLUVZ0NDc2Z2YxeldXRiI7czo0OiJsYW5nIjtzOjI6ImhyIjtzOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoxMDg6Imh0dHA6Ly9tb29kbGUtZGV2LnAuc3JjZS5oci9rYXRhbG9nNTMvbGFuZz9jdXJyZW50X3VybD1odHRwJTNBJTJGJTJGbW9vZGxlLWRldi5wLnNyY2UuaHIlMkZrYXRhbG9nNTMmbGFuZz1ociI7fXM6MjI6IlBIUERFQlVHQkFSX1NUQUNLX0RBVEEiO2E6MDp7fXM6OToiX3NmMl9tZXRhIjthOjM6e3M6MToidSI7aToxNDg0NzI1MTkzO3M6MToiYyI7aToxNDg0NzI1MTkzO3M6MToibCI7czoxOiIwIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==, 1484725193, , 161.53.254.88, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36, tqXoLhN2U0A6FwWaDSRwshTDznxATIvwhGwcZZnP))' in /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Database/Connection.php:774
Stack trace:
#0 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Database/Connection.php(730): Illuminate\Database\Connection->runQueryCallback('insert into "se...', Array, Object(Closure))
#1 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Database/Connection.php(481): Illuminate\Database\Connection->run('insert into "se...', Array, Object(Closure))
#2 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Database/Connection.php(435): Illuminate\Database\Connection->statement('insert into "se...', Array)
#3 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2138): Illuminate\Database\Connection->insert('insert into "se...', Array)
#4 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php(119): Illuminate\Database\Query\Builder->insert(Array)
#5 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Session/Store.php(263): Illuminate\Session\DatabaseSessionHandler->write('tqXoLhN2U0A6FwW...', 'a:6:{s:6:"_toke...')
#6 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(88): Illuminate\Session\Store->save()
#7 /var/www/merlin/katalog53/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(177): Illuminate\Session\Middleware\StartSession->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#8 /var/www/merlin/katalog53/public/index.php(57): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#9 {main}  

If I try to do var_dump of any variable at the lines from the trace I get nothing, like that code is never executed :/

Zvone

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.