File manager - Edit - /var/www/html/portalHomolog/app/Http/Requests/Admin/ThemeRequest.php
Back
<?php namespace App\Http\Requests\Admin; use Illuminate\Foundation\Http\FormRequest; class ThemeRequest extends FormRequest { public function authorize(): bool { return true; } public function rules(): array { $tema = $this->route('tema'); $temaId = $tema ? $tema->id : null; return [ 'name' => 'required|string|max:255|unique:temas,nome,' . $temaId . ',id', 'colors' => 'sometimes|array', 'colors.*' => [ 'nullable', 'string', function ($attribute, $value, $fail) { if ($value !== null && $value !== '' && !preg_match('/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/i', $value)) { $fail(__('Informe uma cor válida no formato hexadecimal (ex: #FFFFFF).')); } }, ], 'apply_public' => 'sometimes|boolean', 'apply_admin' => 'sometimes|boolean', 'logo' => 'nullable|file|mimes:png,jpg,jpeg,svg,webp|mimetypes:image/png,image/jpeg,image/svg+xml,image/webp|max:2048', 'remove_logo' => 'sometimes|boolean', ]; } public function messages(): array { return [ 'name.required' => __('Por favor, informe um nome para o tema.'), 'name.unique' => __('Já existe um tema com este nome.'), 'colors.*.regex' => __('Informe uma cor válida no formato hexadecimal (ex: #FFFFFF).'), 'logo.file' => __('O arquivo enviado é inválido.'), 'logo.mimes' => __('A logo deve estar em um dos formatos: PNG, JPG, JPEG, SVG ou WebP.'), 'logo.mimetypes' => __('A logo deve estar em um dos formatos: PNG, JPG, JPEG, SVG ou WebP.'), 'logo.max' => __('A logo não pode ter mais de 2MB.'), ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings