method()) { case 'POST': { return $this->getPostRules(); } case 'PUT': { return $this->getPutRules(); } default: { return []; } } } private function getPostRules() { return [ 'nome' => [ 'required', 'string', 'between:3,180', 'unique:\App\Models\Cadastro\Localizacao\Bairro,nome,NULL,id,deleted_at,NULL', ] ]; } private function getPutRules() { return [ 'nome' => [ 'required', 'string', 'between:3,180', "unique:\App\Models\Cadastro\Localizacao\Bairro,nome,{$this->bairro},id,deleted_at,NULL", ] ]; } public function messages() { return [ 'nome.unique' => 'O nome do Bairro já foi inserido anteriormente.' ]; } }