cms/app/Http/Requests/Admin/Settings/UpdateSettingRequest.php

43 lines
1.4 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Requests\Admin\Settings;
use Illuminate\Foundation\Http\FormRequest;
/**
* Validates requests for updating site-wide settings.
*/
class UpdateSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user()->hasPermission('update-settings');
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'site_title' => 'required|string|max:255',
'seo_description' => 'nullable|string|max:500',
'seo_keywords' => 'nullable|array',
'seo_keywords.*' => 'string|max:50',
'supported_languages' => 'required|array|min:1',
'supported_languages.*.name' => 'required|string|max:50',
'supported_languages.*.abbreviation' => 'required|string|size:2',
'default_locale' => 'required|string|size:2',
'translation_driver' => 'required|string|in:mock,google,deepl,openai',
'google_translate_key' => 'nullable|string|max:255',
'deepl_api_key' => 'nullable|string|max:255',
'openai_api_key' => 'nullable|string|max:255',
];
}
}