2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Admin\Locations;
|
|
|
|
|
|
2026-10-09 06:26:45 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2026-10-11 06:17:07 -04:00
|
|
|
use Pterodactyl\Actions\Locations\CreateLocation;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Enum\Permissions;
|
|
|
|
|
use Pterodactyl\Http\Requests\Api\Admin\AdminApiRequest;
|
2026-10-09 06:26:45 +01:00
|
|
|
use Pterodactyl\Http\Requests\Concerns\ValidatesExtensionFields;
|
|
|
|
|
use Pterodactyl\Models\Location;
|
2026-10-05 18:10:18 -04:00
|
|
|
|
|
|
|
|
class StoreLocationRequest extends AdminApiRequest
|
|
|
|
|
{
|
2026-10-09 06:26:45 +01:00
|
|
|
use ValidatesExtensionFields;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
public function permissions(): array
|
|
|
|
|
{
|
|
|
|
|
return [Permissions::AdminLocationsCreate];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Validation rules for creating a location.
|
|
|
|
|
*
|
|
|
|
|
* @return ValidationRules
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
2026-10-11 06:17:07 -04:00
|
|
|
return CreateLocation::rules();
|
2026-10-05 18:10:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Rename fields to be more clear in error messages. */
|
|
|
|
|
public function attributes(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'short' => 'Location Identifier',
|
|
|
|
|
'long' => 'Location Description',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-09 06:26:45 +01:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
protected function extensionFieldsModel(): Model|string
|
|
|
|
|
{
|
|
|
|
|
return Location::class;
|
|
|
|
|
}
|
2026-10-05 18:10:18 -04:00
|
|
|
}
|