check(); } protected function permission($permission): bool { return !$this->auth() ? false : auth()->user()->can(['*', $permission]); } protected function model($functionName): bool { return empty($this->model) ? false : $this->model->{$functionName}(); } protected function owner(): bool { return !$this->auth() || empty($this->model) ? false : $this->model->user_id == auth()->user()->id; } protected function group(): bool { return !$this->auth() || empty($this->model) ? false : $this->model->group_id == auth()->user()->group_id; } protected function guest(): bool { return !$this->auth(); } }