Ejemplo n.º 1
0
 /**
  * Handle an incoming request
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guard()->check()) {
         return $this->redirect->route('admin', $this->app->getLocale());
     }
     return $next($request);
 }
Ejemplo n.º 2
0
 /**
  * Get User
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable
  */
 protected function getUser()
 {
     if (!$this->user) {
         $authGuard = $this->config->get('nwlaravel.activity.auth_guard') ?: $this->auth->getDefaultDriver();
         $this->user = $this->auth->guard($authGuard)->user();
     }
     return $this->user;
 }
Ejemplo n.º 3
0
 public function __construct(AuthManager $auth, Repository $config)
 {
     $this->auth = $auth;
     $this->properties = collect();
     $authDriver = $config['laravel-activitylog']['default_auth_driver'] ?? $auth->getDefaultDriver();
     if (starts_with(app()->version(), '5.1')) {
         $this->causedBy = $auth->driver($authDriver)->user();
     } else {
         $this->causedBy = $auth->guard($authDriver)->user();
     }
     $this->logName = $config['laravel-activitylog']['default_log_name'];
     $this->logEnabled = $config['laravel-activitylog']['enabled'] ?? true;
 }
Ejemplo n.º 4
0
 /**
  * Attempt to get the guard from the local cache.
  *
  * @param string $name
  * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard 
  * @static 
  */
 public static function guard($name = null)
 {
     return \Illuminate\Auth\AuthManager::guard($name);
 }
Ejemplo n.º 5
0
 /**
  * Log the user out of the admin and redirect him to auth page
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getLogout()
 {
     $this->auth->guard()->logout();
     return $this->redirect->route('auth');
 }
Ejemplo n.º 6
0
 /**
  * Create a new basic provider instance.
  *
  * @param \Illuminate\Auth\AuthManager $auth
  */
 public function __construct(AuthManager $auth)
 {
     $this->auth = $auth->guard($this->guard);
 }