Skip to content

Commit

Permalink
Adding the ability to use another session store
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Aug 30, 2020
1 parent a47b1a9 commit 0d91ba2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/impersonator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

'session' => [
'key' => 'impersonator_id',

'guard' => 'impersonator_guard',

'store' => null,
],

];
5 changes: 4 additions & 1 deletion src/ImpersonatorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ private function extendAuthDriver(): void

$auth->extend('session', function (Application $app, $name, array $config) use ($auth) {
$provider = $auth->createUserProvider($config['provider']);
$store = $app['session']->driver(
$app['config']['impersonator.session.store']
);

return tap(
new Guard\SessionGuard($name, $provider, $app['session.store']),
new Guard\SessionGuard($name, $provider, $store),
function (IlluminateSessionGuard $guard) use ($app) {
if (method_exists($guard, 'setCookieJar'))
$guard->setCookieJar($app['cookie']);
Expand Down

0 comments on commit 0d91ba2

Please sign in to comment.