misc_pterodactyl-panel/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php

32 lines
742 B
PHP
Raw Normal View History

<?php
2018-01-20 01:58:57 +00:00
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
use Pterodactyl\Models\Location;
class UpdateLocationRequest extends StoreLocationRequest
{
/**
* Determine if the requested location exists on the Panel.
*/
public function resourceExists(): bool
{
$location = $this->route()->parameter('location');
return $location instanceof Location && $location->exists;
}
/**
2018-05-13 14:50:56 +00:00
* Rules to validate this request against.
*/
public function rules(): array
{
$locationId = $this->route()->parameter('location')->id;
return collect(Location::getRulesForUpdate($locationId))->only([
'short',
'long',
])->toArray();
}
}