Created
April 19, 2017 21:30
Revisions
-
calebporzio created this gist
Apr 19, 2017 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php // Until SessionGuard Macros get pulled into Laravel core from a PR: // Remove this when Laravel 5.4.18 is released. $this->app->config->set('auth.guards.hack', [ 'driver' => 'modified-session', 'provider' => 'users', ]); Auth::extend('modified-session', function ($app, $name, $config) { // The following is taken from AuthManager@createSessionDriver $provider = Auth::createUserProvider($config['provider']); $guard = new class ($name, $provider, $app['session.store']) extends SessionGuard { // This allows Auth::macro(...) use Macroable; }; if (method_exists($guard, 'setCookieJar')) { $guard->setCookieJar($app['cookie']); } if (method_exists($guard, 'setDispatcher')) { $guard->setDispatcher($app['events']); } if (method_exists($guard, 'setRequest')) { $guard->setRequest($app->refresh('request', $guard, 'setRequest')); } return $guard; }); Auth::shouldUse('hack');