Created
February 8, 2015 21:56
-
-
Save vanchelo/99542705ec0d6296f741 to your computer and use it in GitHub Desktop.
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 characters
<?php namespace Backend\Auth; | |
use Illuminate\Auth\AuthManager as BaseAuthManager; | |
use Illuminate\Auth\EloquentUserProvider; | |
class AuthManager extends BaseAuthManager | |
{ | |
/** | |
* Create an instance of the Eloquent driver. | |
* | |
* @return \Illuminate\Auth\Guard | |
*/ | |
public function createEloquentDriver() | |
{ | |
$provider = $this->createEloquentProvider(); | |
return new Guard($provider, $this->app['session.store']); | |
} | |
/** | |
* Create an instance of the Eloquent user provider. | |
* | |
* @return \Illuminate\Auth\EloquentUserProvider | |
*/ | |
protected function createEloquentProvider() | |
{ | |
$model = $this->app['config']->get('auth.model'); | |
return new EloquentUserProvider($this->app['hash'], $model); | |
} | |
/** | |
* Get the default authentication driver name. | |
* | |
* @return string | |
*/ | |
public function getDefaultDriver() | |
{ | |
return 'eloquent'; | |
} | |
} |
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 characters
<?php namespace Backend\Auth; | |
use Illuminate\Support\ServiceProvider; | |
class AuthServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Indicates if loading of the provider is deferred. | |
* | |
* @var bool | |
*/ | |
protected $defer = true; | |
/** | |
* Register the service provider. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$this->app->bindShared('backend.auth', function ($app) | |
{ | |
return new AuthManager($app); | |
}); | |
} | |
/** | |
* Get the services provided by the provider. | |
* | |
* @return array | |
*/ | |
public function provides() | |
{ | |
return ['backend.auth']; | |
} | |
} |
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 characters
<?php namespace Backend\Auth\Facades; | |
use Illuminate\Support\Facades\Facade; | |
/** | |
* @see \Illuminate\Auth\AuthManager | |
* @see \Illuminate\Auth\Guard | |
*/ | |
class Auth extends Facade | |
{ | |
/** | |
* Get the registered name of the component. | |
* | |
* @return string | |
*/ | |
protected static function getFacadeAccessor() | |
{ | |
return 'backend.auth'; | |
} |
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 characters
<?php namespace 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