Created
February 24, 2015 12:58
-
-
Save Donclurd/b35289fb8c1deacce4b3 to your computer and use it in GitHub Desktop.
Backend Authentication
This file contains hidden or 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 characters
<?php namespace App\Domain\Backend\Auth; | |
use Illuminate\Auth\EloquentUserProvider; | |
class AuthManager extends \Illuminate\Auth\AuthManager | |
{ | |
protected function createEloquentProvider() | |
{ | |
$model = 'App\Models\BackendUser'; | |
return new EloquentUserProvider($this->app['hash'], $model); | |
} | |
public function createEloquentDriver() | |
{ | |
$provider = $this->createEloquentProvider(); | |
return new Guard($provider, $this->app['session.store']); | |
} | |
} |
This file contains hidden or 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 characters
<?php namespace App\Providers; | |
use App\Domain\Backend\Auth\AuthManager; | |
use Illuminate\Support\ServiceProvider; | |
class BackendServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ | |
$this->app->singleton('backend.auth', function ($app) { | |
$app['backend.auth.loaded'] = true; | |
return new AuthManager($app); | |
}); | |
$this->app->singleton('backend.auth.driver', function ($app) { | |
return $app['backend.auth']->driver(); | |
}); | |
$this->app->alias('backend.auth', 'App\Domain\Backend\Auth\AuthManager'); | |
$this->app->alias('backend.auth.driver', 'App\Domain\Backend\Auth\Guard'); | |
} | |
} |
This file contains hidden or 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 characters
<?php namespace App\Domain\Backend\Auth; | |
class Guard extends \Illuminate\Auth\Guard | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment