user()->can('edit', $this->task); } public function rules() { $rules = []; /* Ensure we have a client name, and that all emails are unique*/ if ($this->input('number')) { $rules['number'] = 'unique:tasks,number,'.$this->id.',id,company_id,'.$this->task->company_id; } return $this->globalRules($rules); } protected function prepareForValidation() { $input = $this->decodePrimaryKeys($this->all()); $this->replace($input); } }