47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Administracao;
|
|
|
|
use App\Services\Service;
|
|
use Illuminate\Validation\Rule;
|
|
use App\Models\Administracao\Configuracao;
|
|
|
|
class ConfiguracaoService extends Service
|
|
{
|
|
|
|
public static function edit()
|
|
{
|
|
|
|
$configuracao = Configuracao::first();
|
|
|
|
return [
|
|
'form' => [
|
|
'instrumentos_registro' => [
|
|
['codigo' => '01', 'nome' => 'BPA (CONSOLIDADO)'],
|
|
['codigo' => '02', 'nome' => 'BPA (INDIVIDUALIZADO)'],
|
|
],
|
|
],
|
|
'model' => [
|
|
'bpa_intrumento_registro_padrao' => $configuracao->bpa_intrumento_registro_padrao ?? null,
|
|
],
|
|
];
|
|
}
|
|
|
|
public static function update($request)
|
|
{
|
|
self::validate($request);
|
|
|
|
return tap(Configuracao::first())->update($request->all());
|
|
}
|
|
|
|
private static function validate($request)
|
|
{
|
|
return $request->validate([
|
|
'bpa_intrumento_registro_padrao' => [
|
|
'required',
|
|
Rule::in(['01', '02']),
|
|
],
|
|
]);
|
|
}
|
|
}
|