mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
26 lines
650 B
PHP
26 lines
650 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Validation;
|
|
|
|
use Illuminate\Validation\Rule;
|
|
use Pterodactyl\Models\Location;
|
|
|
|
final class LocationRules
|
|
{
|
|
/**
|
|
* Validation rules for the location requests and p:location:make.
|
|
*
|
|
* @param Location|null $ignore the location being updated
|
|
* @return NormalizedValidationRules
|
|
*/
|
|
public static function rules(?Location $ignore = null): array
|
|
{
|
|
return [
|
|
'short' => ['required', 'string', 'between:1,60', Rule::unique('locations', 'short')->ignore($ignore)],
|
|
'long' => ['string', 'nullable', 'between:1,191'],
|
|
];
|
|
}
|
|
}
|