/** * 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; }
/** * Get the default authentication driver name. * * @return string * @static */ public static function getDefaultDriver() { return \Illuminate\Auth\AuthManager::getDefaultDriver(); }