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,46 @@
<?php
namespace App\Rules\Sigtap\Procedimento;
use App\Models\Sigtap\Ocupacao as OcupacaoSigtap;
use App\Models\Sigtap\Procedimento;
use App\Services\Sigtap\ProcedimentoValidationService;
use Illuminate\Contracts\Validation\Rule;
class Ocupacao implements Rule
{
private Procedimento $procedimento;
private OcupacaoSigtap $ocupacao;
private $field;
public function __construct(Procedimento $procedimento, OcupacaoSigtap $ocupacao, $field = null)
{
$this->procedimento = $procedimento;
$this->ocupacao = $ocupacao;
$this->field = $field;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$validation = new ProcedimentoValidationService($this->procedimento);
return $validation->isOcupacaoValid($this->ocupacao);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return ($this->field ?? ':attribute') . ' não permitido para o CBO.';
}
}