This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?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.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user