39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateDocumentTemplateRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
$u = $this->user();
|
|
|
|
return $u && ($u->hasPermission('manage-document-templates') || $u->hasPermission('manage-settings') || $u->hasRole('admin'));
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'output_filename_pattern' => ['nullable', 'string', 'max:255'],
|
|
'date_format' => ['nullable', 'string', 'max:40'],
|
|
'fail_on_unresolved' => ['sometimes', 'boolean'],
|
|
'number_decimals' => ['nullable', 'integer', 'min:0', 'max:6'],
|
|
'decimal_separator' => ['nullable', 'string', 'max:2'],
|
|
'thousands_separator' => ['nullable', 'string', 'max:2'],
|
|
'currency_symbol' => ['nullable', 'string', 'max:8'],
|
|
'currency_position' => ['nullable', 'in:before,after'],
|
|
'currency_space' => ['nullable', 'boolean'],
|
|
'default_date_format' => ['nullable', 'string', 'max:40'],
|
|
'date_formats' => ['nullable', 'array'],
|
|
'date_formats.*' => ['nullable', 'string', 'max:40'],
|
|
'meta' => ['sometimes', 'array'],
|
|
'meta.*' => ['nullable'],
|
|
'action_id' => ['nullable', 'integer', 'exists:actions,id'],
|
|
'decision_id' => ['nullable', 'integer', 'exists:decisions,id'],
|
|
'activity_note_template' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
}
|