2017-06-15 04:53:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Admin;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Location;
|
|
|
|
|
2017-08-06 02:10:32 +00:00
|
|
|
class LocationFormRequest extends AdminFormRequest
|
2017-06-15 04:53:24 +00:00
|
|
|
{
|
|
|
|
/**
|
2022-10-14 16:59:20 +00:00
|
|
|
* Set up the validation rules to use for these requests.
|
2017-06-15 04:53:24 +00:00
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function rules(): array
|
2017-06-15 04:53:24 +00:00
|
|
|
{
|
2017-06-25 00:49:09 +00:00
|
|
|
if ($this->method() === 'PATCH') {
|
2022-11-28 16:56:03 +00:00
|
|
|
/** @var Location $location */
|
|
|
|
$location = $this->route()->parameter('location');
|
|
|
|
|
|
|
|
return Location::getRulesForUpdate($location->id);
|
2017-06-25 00:49:09 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 05:26:28 +00:00
|
|
|
return Location::getRules();
|
2017-06-15 04:53:24 +00:00
|
|
|
}
|
|
|
|
}
|