2018-01-12 20:39:15 -06:00
|
|
|
<?php
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-11-19 22:03:03 -07:00
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
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;
|
2018-01-19 21:47:06 -06:00
|
|
|
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
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
|
|
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
2018-01-19 21:47:06 -06:00
|
|
|
class StoreLocationRequest extends ApplicationApiRequest
|
2018-01-12 20:39:15 -06:00
|
|
|
{
|
2026-10-09 06:26:45 +01:00
|
|
|
use ValidatesExtensionFields;
|
|
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
protected int $permission = AdminAcl::WRITE;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
|
|
|
|
/**
|
2018-05-13 10:50:56 -04:00
|
|
|
* Rules to validate the request against.
|
2026-10-05 18:10:18 -04:00
|
|
|
*
|
|
|
|
|
* @return ValidationRules
|
2018-01-12 20:39:15 -06:00
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
2026-10-11 06:17:07 -04:00
|
|
|
return CreateLocation::rules();
|
2018-01-12 20:39:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Rename fields to be more clear in error messages.
|
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function attributes(): array
|
2018-01-12 20:39:15 -06:00
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'long' => 'Location Description',
|
|
|
|
|
'short' => 'Location Identifier',
|
|
|
|
|
];
|
|
|
|
|
}
|
2026-10-05 18:10:18 -04:00
|
|
|
|
2026-10-09 06:26:45 +01:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
protected function extensionFieldsModel(): Model|string
|
|
|
|
|
{
|
|
|
|
|
return Location::class;
|
|
|
|
|
}
|
2018-01-12 20:39:15 -06:00
|
|
|
}
|