/** * 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); }
/** * 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; }
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; }
/** * 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); }
/** * 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'); }
/** * Create a new basic provider instance. * * @param \Illuminate\Auth\AuthManager $auth */ public function __construct(AuthManager $auth) { $this->auth = $auth->guard($this->guard); }