mirror of
https://github.com/BillyOutlast/UNIT3D.git
synced 2026-02-06 04:01:20 +01:00
49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
*
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Http\Requests\Staff;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Closure;
|
|
|
|
class StoreAutomaticTorrentFreeleechRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, array<int, (Closure)|string>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name_regex' => [
|
|
'nullable',
|
|
function (string $attribute, mixed $value, Closure $fail): void {
|
|
if (@preg_match($value, 'Validate regex') === false) {
|
|
$fail('Regex syntax error.');
|
|
}
|
|
},
|
|
],
|
|
'position' => ['required', 'integer', 'min:0'],
|
|
'size' => ['nullable', 'integer', 'min:0'],
|
|
'category_id' => ['nullable', 'integer', 'exists:categories,id'],
|
|
'type_id' => ['nullable', 'integer', 'exists:types,id'],
|
|
'resolution_id' => ['nullable', 'integer', 'exists:resolutions,id'],
|
|
'freeleech_percentage' => ['required', 'integer', 'max:100', 'min:0'],
|
|
];
|
|
}
|
|
}
|