init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Http\Requests\Cadastro\Localizacao;
use App\Http\Requests\FormRequest;
class BairroRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
switch ($this->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.'
];
}
}