user()->id === $this->id || auth()->user()->isAdmin(); } public function rules() { $input = $this->all(); $rules = []; if(isset($input['email'])) $rules['email'] = ['sometimes', new UniqueUserRule($this->user, $input['email'])]; return $rules; } protected function prepareForValidation() { $input = $this->all(); if(isset($input['company_user']) && !auth()->user()->isAdmin()) unset($input['company_user']); $this->replace($input); } }