Add client API

This commit is contained in:
Dane Everitt 2018-02-28 22:51:04 -06:00
parent 4e12c289ed
commit 2017e640b6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 89 additions and 1 deletions

View file

@ -24,7 +24,7 @@ class SendCommandRequest extends GetServerRequest
public function rules(): array
{
return [
'command' => 'string|min:1',
'command' => 'required|string|min:1',
];
}
}

View file

@ -0,0 +1,31 @@
<?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('power-' . $this->input('signal', '_undefined'), $this->getModel(Server::class));
}
/**
* Rules to validate this request aganist.
*
* @return array
*/
public function rules(): array
{
return [
'signal' => 'required|string|in:start,stop,restart,kill',
];
}
}