Files
UNIT3D-Community-Edition/app/Http/Requests/UpdateGeneralSettingRequest.php
Roardom d66f84dc4a update: allow saving default torrent sort column
After 10+ hours of debugging and searching through livewire issues, it turns out that the query string doesn't update if you have `history: true` in the `#[Url()]` attribute.
2024-06-01 11:37:15 +00:00

60 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests;
use App\Models\Language;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateGeneralSettingRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'censor' => [
'required',
'boolean',
],
'chat_hidden' => [
'required',
'boolean',
],
'locale' => [
'required',
Rule::in(array_keys(Language::allowed())),
],
'style' => [
'required',
'numeric',
],
'custom_css' => [
'nullable',
'url',
],
'standalone_css' => [
'nullable',
'url',
],
'torrent_layout' => [
'required',
Rule::in([0, 1, 2, 3]),
],
'torrent_sort_field' => [
'required',
Rule::in(['created_at', 'bumped_at']),
],
'show_poster' => [
'required',
'boolean',
],
];
}
}