24 lines
599 B
PHP
24 lines
599 B
PHP
<?php
|
|
|
|
namespace App\Rules\Sigtap;
|
|
|
|
use App\Models\Sigtap\Procedimento;
|
|
use App\Services\Sigtap\ProcedimentoValidationService;
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
|
|
class CompetenciaAtualIsValidForProcedimento implements Rule
|
|
{
|
|
public function passes($attribute, $value)
|
|
{
|
|
$procedimento = Procedimento::findOrFail($value);
|
|
$validation = new ProcedimentoValidationService($procedimento);
|
|
|
|
return $validation->isOnValidCompetencia();
|
|
}
|
|
|
|
public function message()
|
|
{
|
|
return 'Competência não permitida para o procedimento selecionado.';
|
|
}
|
|
}
|