Add client API
This commit is contained in:
parent
4e12c289ed
commit
2017e640b6
3 changed files with 89 additions and 1 deletions
|
@ -24,7 +24,7 @@ class SendCommandRequest extends GetServerRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'string|min:1',
|
||||
'command' => 'required|string|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
31
app/Http/Requests/Api/Client/Servers/SendPowerRequest.php
Normal file
31
app/Http/Requests/Api/Client/Servers/SendPowerRequest.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue