phpstan
This commit is contained in:
parent
7ed2be50fd
commit
3670dc6d4b
5 changed files with 5 additions and 10 deletions
|
@ -14,6 +14,7 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
|
||||||
{
|
{
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
$server = $this->route()->parameter('server');
|
$server = $this->route()->parameter('server');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -13,6 +13,6 @@ class DownloadFileRequest extends ClientApiRequest
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return $this->user()->can('file.read', $this->parameter('server', Server::class));
|
return $this->user()->can('file.read', $this->route()->parameter('server'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Node extends Model
|
||||||
*/
|
*/
|
||||||
public function getConnectionAddress(): string
|
public function getConnectionAddress(): string
|
||||||
{
|
{
|
||||||
return sprintf('%s://%s:%s', $this->scheme, $this->fqdn, $this->daemonListen);
|
return sprintf('%s://%s:%s', $this->scheme, $this->fqdn, $this->public_port_http);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,13 +30,7 @@ class NodeTransformer extends Transformer
|
||||||
*/
|
*/
|
||||||
public function transform(Node $model): array
|
public function transform(Node $model): array
|
||||||
{
|
{
|
||||||
$response = collect($model->toArray())->mapWithKeys(function ($value, $key) {
|
$response = $model->toArray();
|
||||||
// I messed up early in 2016 when I named this column as poorly
|
|
||||||
// as I did. This is the tragic result of my mistakes.
|
|
||||||
$key = ($key === 'daemonSFTP') ? 'daemonSftp' : $key;
|
|
||||||
|
|
||||||
return [snake_case($key) => $value];
|
|
||||||
})->toArray();
|
|
||||||
|
|
||||||
$response['created_at'] = self::formatTimestamp($model->created_at);
|
$response['created_at'] = self::formatTimestamp($model->created_at);
|
||||||
$response['updated_at'] = self::formatTimestamp($model->updated_at);
|
$response['updated_at'] = self::formatTimestamp($model->updated_at);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ServerTransformer extends Transformer
|
||||||
'is_node_under_maintenance' => $server->node->isUnderMaintenance(),
|
'is_node_under_maintenance' => $server->node->isUnderMaintenance(),
|
||||||
'sftp_details' => [
|
'sftp_details' => [
|
||||||
'ip' => $server->node->fqdn,
|
'ip' => $server->node->fqdn,
|
||||||
'port' => $server->node->daemonSFTP,
|
'port' => $server->node->public_port_sftp,
|
||||||
],
|
],
|
||||||
'description' => $server->description,
|
'description' => $server->description,
|
||||||
'limits' => [
|
'limits' => [
|
||||||
|
|
Loading…
Reference in a new issue