/** * Get Laravel Auth (5.2 or 5.0 compatibility) */ public static function getAuth() { $auth = auth(); if (method_exists($auth, 'guard')) { return $auth->guard('arxmin'); } else { return Auth::driver('arxmin'); } }
/** * Register any application services. * * @return void */ public function register() { Auth::extend('userEloquent', function ($app) { // you can use Config::get() to retrieve the model class name from config file $myProvider = new EloquentUserProvider($app['hash'], '\\App\\Models\\User'); return new Guard($myProvider, $app['session.store']); }); $this->app->singleton('auth.driver_user', function ($app) { return Auth::driver('userEloquent'); }); }