2018-01-13 02:39:15 +00:00
|
|
|
<?php
|
|
|
|
|
2018-01-20 01:58:57 +00:00
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
|
2018-01-13 02:39:15 +00:00
|
|
|
|
|
|
|
use Pterodactyl\Models\Location;
|
|
|
|
|
|
|
|
class UpdateLocationRequest extends StoreLocationRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the requested location exists on the Panel.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
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.
|
2018-01-13 02:39:15 +00:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
$locationId = $this->route()->parameter('location')->id;
|
|
|
|
|
2019-09-05 05:26:28 +00:00
|
|
|
return collect(Location::getRulesForUpdate($locationId))->only([
|
2018-01-13 02:39:15 +00:00
|
|
|
'short',
|
|
|
|
'long',
|
2019-03-02 21:27:36 +00:00
|
|
|
])->toArray();
|
2018-01-13 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|