misc_pterodactyl-panel/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php

32 lines
726 B
PHP
Raw Normal View History

2018-03-01 04:51:04 +00:00
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers;
use Pterodactyl\Models\Server;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class SendPowerRequest extends ClientApiRequest
{
/**
* Determine if the user has permission to send a power command to a server.
*
* @return bool
*/
public function authorize(): bool
{
return $this->user()->can('control.' . $this->input('signal', ''), $this->getModel(Server::class));
2018-03-01 04:51:04 +00:00
}
/**
2018-05-13 14:50:56 +00:00
* Rules to validate this request against.
2018-03-01 04:51:04 +00:00
*
* @return array
*/
public function rules(): array
{
return [
'signal' => 'required|string|in:start,stop,restart,kill',
];
}
}