Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -3,21 +3,19 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $node_id
|
||||
* @property string $ip
|
||||
* @property string|null $ip_alias
|
||||
* @property int $port
|
||||
* @property int|null $server_id
|
||||
* @property string|null $notes
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
*
|
||||
* @property string $alias
|
||||
* @property bool $has_alias
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $node_id
|
||||
* @property string $ip
|
||||
* @property string|null $ip_alias
|
||||
* @property int $port
|
||||
* @property int|null $server_id
|
||||
* @property string|null $notes
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
* @property string $alias
|
||||
* @property bool $has_alias
|
||||
* @property \Pterodactyl\Models\Server|null $server
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
*/
|
||||
class Allocation extends Model
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ class Allocation extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'allocation';
|
||||
public const RESOURCE_NAME = 'allocation';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -78,6 +76,7 @@ class Allocation extends Model
|
|||
* Accessor to automatically provide the IP alias if defined.
|
||||
*
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAliasAttribute($value)
|
||||
|
@ -89,11 +88,12 @@ class Allocation extends Model
|
|||
* Accessor to quickly determine if this allocation has an alias.
|
||||
*
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getHasAliasAttribute($value)
|
||||
{
|
||||
return ! is_null($this->ip_alias);
|
||||
return !is_null($this->ip_alias);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,16 +5,16 @@ namespace Pterodactyl\Models;
|
|||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $key_type
|
||||
* @property string $identifier
|
||||
* @property string $token
|
||||
* @property array $allowed_ips
|
||||
* @property string $memo
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $key_type
|
||||
* @property string $identifier
|
||||
* @property string $token
|
||||
* @property array $allowed_ips
|
||||
* @property string $memo
|
||||
* @property \Carbon\Carbon|null $last_used_at
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*/
|
||||
class ApiKey extends Model
|
||||
{
|
||||
|
@ -22,27 +22,27 @@ class ApiKey extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'api_key';
|
||||
public const RESOURCE_NAME = 'api_key';
|
||||
|
||||
/**
|
||||
* Different API keys that can exist on the system.
|
||||
*/
|
||||
const TYPE_NONE = 0;
|
||||
const TYPE_ACCOUNT = 1;
|
||||
const TYPE_APPLICATION = 2;
|
||||
const TYPE_DAEMON_USER = 3;
|
||||
const TYPE_DAEMON_APPLICATION = 4;
|
||||
public const TYPE_NONE = 0;
|
||||
public const TYPE_ACCOUNT = 1;
|
||||
public const TYPE_APPLICATION = 2;
|
||||
public const TYPE_DAEMON_USER = 3;
|
||||
public const TYPE_DAEMON_APPLICATION = 4;
|
||||
|
||||
/**
|
||||
* The length of API key identifiers.
|
||||
*/
|
||||
const IDENTIFIER_LENGTH = 16;
|
||||
public const IDENTIFIER_LENGTH = 16;
|
||||
|
||||
/**
|
||||
* The length of the actual API key that is encrypted and stored
|
||||
* in the database.
|
||||
*/
|
||||
const KEY_LENGTH = 32;
|
||||
public const KEY_LENGTH = 32;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -5,31 +5,30 @@ namespace Pterodactyl\Models;
|
|||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property string $uuid
|
||||
* @property bool $is_successful
|
||||
* @property string $name
|
||||
* @property string[] $ignored_files
|
||||
* @property string $disk
|
||||
* @property string|null $checksum
|
||||
* @property int $bytes
|
||||
* @property string|null $upload_id
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property string $uuid
|
||||
* @property bool $is_successful
|
||||
* @property string $name
|
||||
* @property string[] $ignored_files
|
||||
* @property string $disk
|
||||
* @property string|null $checksum
|
||||
* @property int $bytes
|
||||
* @property string|null $upload_id
|
||||
* @property \Carbon\CarbonImmutable|null $completed_at
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
* @property \Carbon\CarbonImmutable|null $deleted_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
*/
|
||||
class Backup extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
const RESOURCE_NAME = 'backup';
|
||||
public const RESOURCE_NAME = 'backup';
|
||||
|
||||
const ADAPTER_WINGS = 'wings';
|
||||
const ADAPTER_AWS_S3 = 's3';
|
||||
public const ADAPTER_WINGS = 'wings';
|
||||
public const ADAPTER_AWS_S3 = 's3';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -3,18 +3,17 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property int $database_host_id
|
||||
* @property string $database
|
||||
* @property string $username
|
||||
* @property string $remote
|
||||
* @property string $password
|
||||
* @property int $max_connections
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property int $database_host_id
|
||||
* @property string $database
|
||||
* @property string $username
|
||||
* @property string $remote
|
||||
* @property string $password
|
||||
* @property int $max_connections
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\DatabaseHost $host
|
||||
*/
|
||||
class Database extends Model
|
||||
|
@ -23,7 +22,7 @@ class Database extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server_database';
|
||||
public const RESOURCE_NAME = 'server_database';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $host
|
||||
* @property int $port
|
||||
* @property string $username
|
||||
* @property string $password
|
||||
* @property int|null $max_databases
|
||||
* @property int|null $node_id
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $host
|
||||
* @property int $port
|
||||
* @property string $username
|
||||
* @property string $password
|
||||
* @property int|null $max_databases
|
||||
* @property int|null $node_id
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ class DatabaseHost extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'database_host';
|
||||
public const RESOURCE_NAME = 'database_host';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
|
|
@ -3,46 +3,44 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property int $nest_id
|
||||
* @property string $author
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property array|null $features
|
||||
* @property string $docker_image -- deprecated, use $docker_images
|
||||
* @property string $update_url
|
||||
* @property array $docker_images
|
||||
* @property string $file_denylist
|
||||
* @property string|null $config_files
|
||||
* @property string|null $config_startup
|
||||
* @property string|null $config_logs
|
||||
* @property string|null $config_stop
|
||||
* @property int|null $config_from
|
||||
* @property string|null $startup
|
||||
* @property bool $script_is_privileged
|
||||
* @property string|null $script_install
|
||||
* @property string $script_entry
|
||||
* @property string $script_container
|
||||
* @property int|null $copy_script_from
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property string|null $copy_script_install
|
||||
* @property string $copy_script_entry
|
||||
* @property string $copy_script_container
|
||||
* @property string|null $inherit_config_files
|
||||
* @property string|null $inherit_config_startup
|
||||
* @property string|null $inherit_config_logs
|
||||
* @property string|null $inherit_config_stop
|
||||
* @property string $inherit_file_denylist
|
||||
* @property array|null $inherit_features
|
||||
*
|
||||
* @property \Pterodactyl\Models\Nest $nest
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property int $nest_id
|
||||
* @property string $author
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property array|null $features
|
||||
* @property string $docker_image -- deprecated, use $docker_images
|
||||
* @property string $update_url
|
||||
* @property array $docker_images
|
||||
* @property string $file_denylist
|
||||
* @property string|null $config_files
|
||||
* @property string|null $config_startup
|
||||
* @property string|null $config_logs
|
||||
* @property string|null $config_stop
|
||||
* @property int|null $config_from
|
||||
* @property string|null $startup
|
||||
* @property bool $script_is_privileged
|
||||
* @property string|null $script_install
|
||||
* @property string $script_entry
|
||||
* @property string $script_container
|
||||
* @property int|null $copy_script_from
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string|null $copy_script_install
|
||||
* @property string $copy_script_entry
|
||||
* @property string $copy_script_container
|
||||
* @property string|null $inherit_config_files
|
||||
* @property string|null $inherit_config_startup
|
||||
* @property string|null $inherit_config_logs
|
||||
* @property string|null $inherit_config_stop
|
||||
* @property string $inherit_file_denylist
|
||||
* @property array|null $inherit_features
|
||||
* @property \Pterodactyl\Models\Nest $nest
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables
|
||||
* @property \Pterodactyl\Models\Egg|null $scriptFrom
|
||||
* @property \Pterodactyl\Models\Egg|null $configFrom
|
||||
* @property \Pterodactyl\Models\Egg|null $scriptFrom
|
||||
* @property \Pterodactyl\Models\Egg|null $configFrom
|
||||
*/
|
||||
class Egg extends Model
|
||||
{
|
||||
|
@ -50,7 +48,7 @@ class Egg extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'egg';
|
||||
public const RESOURCE_NAME = 'egg';
|
||||
|
||||
/**
|
||||
* Different features that can be enabled on any given egg. These are used internally
|
||||
|
@ -61,8 +59,8 @@ class Egg extends Model
|
|||
* To skip copying the features, an empty array value should be passed in ("[]") rather
|
||||
* than leaving it null.
|
||||
*/
|
||||
const FEATURE_EULA_POPUP = 'eula';
|
||||
const FEATURE_FASTDL = 'fastdl';
|
||||
public const FEATURE_EULA_POPUP = 'eula';
|
||||
public const FEATURE_FASTDL = 'fastdl';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -150,7 +148,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getCopyScriptInstallAttribute()
|
||||
{
|
||||
if (! is_null($this->script_install) || is_null($this->copy_script_from)) {
|
||||
if (!is_null($this->script_install) || is_null($this->copy_script_from)) {
|
||||
return $this->script_install;
|
||||
}
|
||||
|
||||
|
@ -165,7 +163,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getCopyScriptEntryAttribute()
|
||||
{
|
||||
if (! is_null($this->script_entry) || is_null($this->copy_script_from)) {
|
||||
if (!is_null($this->script_entry) || is_null($this->copy_script_from)) {
|
||||
return $this->script_entry;
|
||||
}
|
||||
|
||||
|
@ -180,7 +178,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getCopyScriptContainerAttribute()
|
||||
{
|
||||
if (! is_null($this->script_container) || is_null($this->copy_script_from)) {
|
||||
if (!is_null($this->script_container) || is_null($this->copy_script_from)) {
|
||||
return $this->script_container;
|
||||
}
|
||||
|
||||
|
@ -194,7 +192,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getInheritConfigFilesAttribute()
|
||||
{
|
||||
if (! is_null($this->config_files) || is_null($this->config_from)) {
|
||||
if (!is_null($this->config_files) || is_null($this->config_from)) {
|
||||
return $this->config_files;
|
||||
}
|
||||
|
||||
|
@ -208,7 +206,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getInheritConfigStartupAttribute()
|
||||
{
|
||||
if (! is_null($this->config_startup) || is_null($this->config_from)) {
|
||||
if (!is_null($this->config_startup) || is_null($this->config_from)) {
|
||||
return $this->config_startup;
|
||||
}
|
||||
|
||||
|
@ -222,7 +220,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getInheritConfigLogsAttribute()
|
||||
{
|
||||
if (! is_null($this->config_logs) || is_null($this->config_from)) {
|
||||
if (!is_null($this->config_logs) || is_null($this->config_from)) {
|
||||
return $this->config_logs;
|
||||
}
|
||||
|
||||
|
@ -236,7 +234,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getInheritConfigStopAttribute()
|
||||
{
|
||||
if (! is_null($this->config_stop) || is_null($this->config_from)) {
|
||||
if (!is_null($this->config_stop) || is_null($this->config_from)) {
|
||||
return $this->config_stop;
|
||||
}
|
||||
|
||||
|
@ -251,7 +249,7 @@ class Egg extends Model
|
|||
*/
|
||||
public function getInheritFeaturesAttribute()
|
||||
{
|
||||
if (! is_null($this->features) || is_null($this->config_from)) {
|
||||
if (!is_null($this->features) || is_null($this->config_from)) {
|
||||
return $this->features;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,20 +3,19 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $egg_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $env_variable
|
||||
* @property string $default_value
|
||||
* @property bool $user_viewable
|
||||
* @property bool $user_editable
|
||||
* @property string $rules
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
*
|
||||
* @property bool $required
|
||||
* @property \Pterodactyl\Models\Egg $egg
|
||||
* @property int $id
|
||||
* @property int $egg_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $env_variable
|
||||
* @property string $default_value
|
||||
* @property bool $user_viewable
|
||||
* @property bool $user_editable
|
||||
* @property string $rules
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
* @property bool $required
|
||||
* @property \Pterodactyl\Models\Egg $egg
|
||||
* @property \Pterodactyl\Models\ServerVariable $serverVariable
|
||||
*
|
||||
* The "server_value" variable is only present on the object if you've loaded this model
|
||||
|
@ -29,14 +28,14 @@ class EggVariable extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'egg_variable';
|
||||
public const RESOURCE_NAME = 'egg_variable';
|
||||
|
||||
/**
|
||||
* Reserved environment variable names.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID';
|
||||
public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
|
|
@ -12,16 +12,12 @@ class AdminServerFilter implements Filter
|
|||
* A multi-column filter for the servers table that allows an administrative user to search
|
||||
* across UUID, name, owner username, and owner email.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $value
|
||||
* @param string $property
|
||||
*/
|
||||
public function __invoke(Builder $query, $value, string $property)
|
||||
{
|
||||
if ($query->getQuery()->from !== 'servers') {
|
||||
throw new BadMethodCallException(
|
||||
'Cannot use the AdminServerFilter against a non-server model.'
|
||||
);
|
||||
throw new BadMethodCallException('Cannot use the AdminServerFilter against a non-server model.');
|
||||
}
|
||||
$query
|
||||
->select('servers.*')
|
||||
|
|
|
@ -20,16 +20,12 @@ class MultiFieldServerFilter implements Filter
|
|||
* search across multiple columns. This allows us to provide a very generic search ability for
|
||||
* the frontend.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $value
|
||||
* @param string $property
|
||||
*/
|
||||
public function __invoke(Builder $query, $value, string $property)
|
||||
{
|
||||
if ($query->getQuery()->from !== 'servers') {
|
||||
throw new BadMethodCallException(
|
||||
'Cannot use the MultiFieldServerFilter against a non-server model.'
|
||||
);
|
||||
throw new BadMethodCallException('Cannot use the MultiFieldServerFilter against a non-server model.');
|
||||
}
|
||||
|
||||
if (preg_match(self::IPV4_REGEX, $value) || preg_match('/^:\d{1,5}$/', $value)) {
|
||||
|
@ -42,12 +38,12 @@ class MultiFieldServerFilter implements Filter
|
|||
$parts = explode(':', $value);
|
||||
|
||||
$builder->when(
|
||||
! Str::startsWith($value, ':'),
|
||||
!Str::startsWith($value, ':'),
|
||||
// When the string does not start with a ":" it means we're looking for an IP or IP:Port
|
||||
// combo, so use a query to handle that.
|
||||
function (Builder $builder) use ($parts) {
|
||||
$builder->orWhere('allocations.ip', $parts[0]);
|
||||
if (! is_null($parts[1] ?? null)) {
|
||||
if (!is_null($parts[1] ?? null)) {
|
||||
$builder->where('allocations.port', 'LIKE', "{$parts[1]}%");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $short
|
||||
* @property string $long
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\Node[] $nodes
|
||||
* @property int $id
|
||||
* @property string $short
|
||||
* @property string $long
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\Node[] $nodes
|
||||
* @property \Pterodactyl\Models\Server[] $servers
|
||||
*/
|
||||
class Location extends Model
|
||||
|
@ -18,7 +17,7 @@ class Location extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'location';
|
||||
public const RESOURCE_NAME = 'location';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class Model extends IlluminateModel
|
|||
static::$validatorFactory = Container::getInstance()->make(Factory::class);
|
||||
|
||||
static::saving(function (Model $model) {
|
||||
if (! $model->validate()) {
|
||||
if (!$model->validate()) {
|
||||
throw new DataValidationException($model->getValidator());
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,10 @@ abstract class Model extends IlluminateModel
|
|||
$rules = $this->getKey() ? static::getRulesForUpdate($this) : static::getRules();
|
||||
|
||||
return $this->validator ?: $this->validator = static::$validatorFactory->make(
|
||||
[], $rules, [], []
|
||||
[],
|
||||
$rules,
|
||||
[],
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -113,7 +116,7 @@ abstract class Model extends IlluminateModel
|
|||
* rather than just creating it.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model|int|string $id
|
||||
* @param string $primaryKey
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRulesForUpdate($id, string $primaryKey = 'id')
|
||||
|
@ -129,7 +132,7 @@ abstract class Model extends IlluminateModel
|
|||
// working model so we don't run into errors due to the way that field validation
|
||||
// works.
|
||||
foreach ($data as &$datum) {
|
||||
if (! is_string($datum) || ! Str::startsWith($datum, 'unique')) {
|
||||
if (!is_string($datum) || !Str::startsWith($datum, 'unique')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -159,7 +162,8 @@ abstract class Model extends IlluminateModel
|
|||
// for that model. Doing this will return all of the attributes in a format that can
|
||||
// properly be validated.
|
||||
$this->addCastAttributesToArray(
|
||||
$this->getAttributes(), $this->getMutatedAttributes()
|
||||
$this->getAttributes(),
|
||||
$this->getMutatedAttributes()
|
||||
)
|
||||
)->passes();
|
||||
}
|
||||
|
@ -168,11 +172,12 @@ abstract class Model extends IlluminateModel
|
|||
* Return a timestamp as DateTime object.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return \Illuminate\Support\Carbon|\Carbon\CarbonImmutable
|
||||
*/
|
||||
protected function asDateTime($value)
|
||||
{
|
||||
if (! $this->immutableDates) {
|
||||
if (!$this->immutableDates) {
|
||||
return parent::asDateTime($value);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,16 @@ namespace Pterodactyl\Models;
|
|||
use Illuminate\Validation\Rules\NotIn;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $source
|
||||
* @property string $target
|
||||
* @property bool $read_only
|
||||
* @property bool $user_mountable
|
||||
*
|
||||
* @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs
|
||||
* @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $source
|
||||
* @property string $target
|
||||
* @property bool $read_only
|
||||
* @property bool $user_mountable
|
||||
* @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs
|
||||
* @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes
|
||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||
*/
|
||||
class Mount extends Model
|
||||
|
@ -24,7 +23,7 @@ class Mount extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'mount';
|
||||
public const RESOURCE_NAME = 'mount';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -3,16 +3,15 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property string $author
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property string $author
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
|
||||
*/
|
||||
class Nest extends Model
|
||||
{
|
||||
|
@ -20,7 +19,7 @@ class Nest extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'nest';
|
||||
public const RESOURCE_NAME = 'nest';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -8,32 +8,31 @@ use Illuminate\Notifications\Notifiable;
|
|||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property bool $public
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property int $location_id
|
||||
* @property string $fqdn
|
||||
* @property string $scheme
|
||||
* @property bool $behind_proxy
|
||||
* @property bool $maintenance_mode
|
||||
* @property int $memory
|
||||
* @property int $memory_overallocate
|
||||
* @property int $disk
|
||||
* @property int $disk_overallocate
|
||||
* @property int $upload_size
|
||||
* @property string $daemon_token_id
|
||||
* @property string $daemon_token
|
||||
* @property int $daemonListen
|
||||
* @property int $daemonSFTP
|
||||
* @property string $daemonBase
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\Location $location
|
||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
* @property bool $public
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property int $location_id
|
||||
* @property string $fqdn
|
||||
* @property string $scheme
|
||||
* @property bool $behind_proxy
|
||||
* @property bool $maintenance_mode
|
||||
* @property int $memory
|
||||
* @property int $memory_overallocate
|
||||
* @property int $disk
|
||||
* @property int $disk_overallocate
|
||||
* @property int $upload_size
|
||||
* @property string $daemon_token_id
|
||||
* @property string $daemon_token
|
||||
* @property int $daemonListen
|
||||
* @property int $daemonSFTP
|
||||
* @property string $daemonBase
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\Location $location
|
||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||
*/
|
||||
class Node extends Model
|
||||
|
@ -44,10 +43,10 @@ class Node extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'node';
|
||||
public const RESOURCE_NAME = 'node';
|
||||
|
||||
const DAEMON_TOKEN_ID_LENGTH = 16;
|
||||
const DAEMON_TOKEN_LENGTH = 64;
|
||||
public const DAEMON_TOKEN_ID_LENGTH = 16;
|
||||
public const DAEMON_TOKEN_LENGTH = 64;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -133,8 +132,6 @@ class Node extends Model
|
|||
|
||||
/**
|
||||
* Get the connection address to use when making calls to this node.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConnectionAddress(): string
|
||||
{
|
||||
|
@ -157,7 +154,7 @@ class Node extends Model
|
|||
'host' => '0.0.0.0',
|
||||
'port' => $this->daemonListen,
|
||||
'ssl' => [
|
||||
'enabled' => (! $this->behind_proxy && $this->scheme === 'https'),
|
||||
'enabled' => (!$this->behind_proxy && $this->scheme === 'https'),
|
||||
'cert' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem',
|
||||
'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem',
|
||||
],
|
||||
|
@ -187,7 +184,6 @@ class Node extends Model
|
|||
/**
|
||||
* Returns the configuration in JSON format.
|
||||
*
|
||||
* @param bool $pretty
|
||||
* @return string
|
||||
*/
|
||||
public function getJsonConfiguration(bool $pretty = false)
|
||||
|
@ -197,8 +193,6 @@ class Node extends Model
|
|||
|
||||
/**
|
||||
* Helper function to return the decrypted key for a node.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDecryptedKey(): string
|
||||
{
|
||||
|
@ -247,10 +241,6 @@ class Node extends Model
|
|||
|
||||
/**
|
||||
* Returns a boolean if the node is viable for an additional server to be placed on it.
|
||||
*
|
||||
* @param int $memory
|
||||
* @param int $disk
|
||||
* @return bool
|
||||
*/
|
||||
public function isViable(int $memory, int $disk): bool
|
||||
{
|
||||
|
|
|
@ -19,16 +19,12 @@ class DeploymentObject
|
|||
*/
|
||||
private $ports = [];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDedicated(): bool
|
||||
{
|
||||
return $this->dedicated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $dedicated
|
||||
* @return $this
|
||||
*/
|
||||
public function setDedicated(bool $dedicated)
|
||||
|
@ -38,16 +34,12 @@ class DeploymentObject
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLocations(): array
|
||||
{
|
||||
return $this->locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $locations
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocations(array $locations)
|
||||
|
@ -57,16 +49,12 @@ class DeploymentObject
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPorts(): array
|
||||
{
|
||||
return $this->ports;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $ports
|
||||
* @return $this
|
||||
*/
|
||||
public function setPorts(array $ports)
|
||||
|
|
|
@ -10,58 +10,58 @@ class Permission extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'subuser_permission';
|
||||
public const RESOURCE_NAME = 'subuser_permission';
|
||||
|
||||
/**
|
||||
* Constants defining different permissions available.
|
||||
*/
|
||||
const ACTION_WEBSOCKET_CONNECT = 'websocket.connect';
|
||||
const ACTION_CONTROL_CONSOLE = 'control.console';
|
||||
const ACTION_CONTROL_START = 'control.start';
|
||||
const ACTION_CONTROL_STOP = 'control.stop';
|
||||
const ACTION_CONTROL_RESTART = 'control.restart';
|
||||
public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect';
|
||||
public const ACTION_CONTROL_CONSOLE = 'control.console';
|
||||
public const ACTION_CONTROL_START = 'control.start';
|
||||
public const ACTION_CONTROL_STOP = 'control.stop';
|
||||
public const ACTION_CONTROL_RESTART = 'control.restart';
|
||||
|
||||
const ACTION_DATABASE_READ = 'database.read';
|
||||
const ACTION_DATABASE_CREATE = 'database.create';
|
||||
const ACTION_DATABASE_UPDATE = 'database.update';
|
||||
const ACTION_DATABASE_DELETE = 'database.delete';
|
||||
const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password';
|
||||
public const ACTION_DATABASE_READ = 'database.read';
|
||||
public const ACTION_DATABASE_CREATE = 'database.create';
|
||||
public const ACTION_DATABASE_UPDATE = 'database.update';
|
||||
public const ACTION_DATABASE_DELETE = 'database.delete';
|
||||
public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password';
|
||||
|
||||
const ACTION_SCHEDULE_READ = 'schedule.read';
|
||||
const ACTION_SCHEDULE_CREATE = 'schedule.create';
|
||||
const ACTION_SCHEDULE_UPDATE = 'schedule.update';
|
||||
const ACTION_SCHEDULE_DELETE = 'schedule.delete';
|
||||
public const ACTION_SCHEDULE_READ = 'schedule.read';
|
||||
public const ACTION_SCHEDULE_CREATE = 'schedule.create';
|
||||
public const ACTION_SCHEDULE_UPDATE = 'schedule.update';
|
||||
public const ACTION_SCHEDULE_DELETE = 'schedule.delete';
|
||||
|
||||
const ACTION_USER_READ = 'user.read';
|
||||
const ACTION_USER_CREATE = 'user.create';
|
||||
const ACTION_USER_UPDATE = 'user.update';
|
||||
const ACTION_USER_DELETE = 'user.delete';
|
||||
public const ACTION_USER_READ = 'user.read';
|
||||
public const ACTION_USER_CREATE = 'user.create';
|
||||
public const ACTION_USER_UPDATE = 'user.update';
|
||||
public const ACTION_USER_DELETE = 'user.delete';
|
||||
|
||||
const ACTION_BACKUP_READ = 'backup.read';
|
||||
const ACTION_BACKUP_CREATE = 'backup.create';
|
||||
const ACTION_BACKUP_UPDATE = 'backup.update';
|
||||
const ACTION_BACKUP_DELETE = 'backup.delete';
|
||||
const ACTION_BACKUP_DOWNLOAD = 'backup.download';
|
||||
public const ACTION_BACKUP_READ = 'backup.read';
|
||||
public const ACTION_BACKUP_CREATE = 'backup.create';
|
||||
public const ACTION_BACKUP_UPDATE = 'backup.update';
|
||||
public const ACTION_BACKUP_DELETE = 'backup.delete';
|
||||
public const ACTION_BACKUP_DOWNLOAD = 'backup.download';
|
||||
|
||||
const ACTION_ALLOCATION_READ = 'allocation.read';
|
||||
const ACTION_ALLOCATION_CREATE = 'allocation.create';
|
||||
const ACTION_ALLOCATION_UPDATE = 'allocation.update';
|
||||
const ACTION_ALLOCATION_DELETE = 'allocation.delete';
|
||||
public const ACTION_ALLOCATION_READ = 'allocation.read';
|
||||
public const ACTION_ALLOCATION_CREATE = 'allocation.create';
|
||||
public const ACTION_ALLOCATION_UPDATE = 'allocation.update';
|
||||
public const ACTION_ALLOCATION_DELETE = 'allocation.delete';
|
||||
|
||||
const ACTION_FILE_READ = 'file.read';
|
||||
const ACTION_FILE_READ_CONTENT = 'file.read-content';
|
||||
const ACTION_FILE_CREATE = 'file.create';
|
||||
const ACTION_FILE_UPDATE = 'file.update';
|
||||
const ACTION_FILE_DELETE = 'file.delete';
|
||||
const ACTION_FILE_ARCHIVE = 'file.archive';
|
||||
const ACTION_FILE_SFTP = 'file.sftp';
|
||||
public const ACTION_FILE_READ = 'file.read';
|
||||
public const ACTION_FILE_READ_CONTENT = 'file.read-content';
|
||||
public const ACTION_FILE_CREATE = 'file.create';
|
||||
public const ACTION_FILE_UPDATE = 'file.update';
|
||||
public const ACTION_FILE_DELETE = 'file.delete';
|
||||
public const ACTION_FILE_ARCHIVE = 'file.archive';
|
||||
public const ACTION_FILE_SFTP = 'file.sftp';
|
||||
|
||||
const ACTION_STARTUP_READ = 'startup.read';
|
||||
const ACTION_STARTUP_UPDATE = 'startup.update';
|
||||
const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image';
|
||||
public const ACTION_STARTUP_READ = 'startup.read';
|
||||
public const ACTION_STARTUP_UPDATE = 'startup.update';
|
||||
public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image';
|
||||
|
||||
const ACTION_SETTINGS_RENAME = 'settings.rename';
|
||||
const ACTION_SETTINGS_REINSTALL = 'settings.reinstall';
|
||||
public const ACTION_SETTINGS_RENAME = 'settings.rename';
|
||||
public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall';
|
||||
|
||||
/**
|
||||
* Should timestamps be used on this model.
|
||||
|
@ -106,6 +106,7 @@ class Permission extends Model
|
|||
* to retrieve them, and not directly access this array as it is subject to change.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @see \Pterodactyl\Models\Permission::permissions()
|
||||
*/
|
||||
protected static $permissions = [
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $token
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $token
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
*/
|
||||
class RecoveryToken extends Model
|
||||
|
@ -15,7 +14,7 @@ class RecoveryToken extends Model
|
|||
/**
|
||||
* There are no updates to this model, only inserts and deletes.
|
||||
*/
|
||||
const UPDATED_AT = null;
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
|
|
@ -8,24 +8,22 @@ use Illuminate\Container\Container;
|
|||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property string $name
|
||||
* @property string $cron_day_of_week
|
||||
* @property string $cron_month
|
||||
* @property string $cron_day_of_month
|
||||
* @property string $cron_hour
|
||||
* @property string $cron_minute
|
||||
* @property bool $is_active
|
||||
* @property bool $is_processing
|
||||
* @property \Carbon\Carbon|null $last_run_at
|
||||
* @property \Carbon\Carbon|null $next_run_at
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property string $hashid
|
||||
*
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property string $name
|
||||
* @property string $cron_day_of_week
|
||||
* @property string $cron_month
|
||||
* @property string $cron_day_of_month
|
||||
* @property string $cron_hour
|
||||
* @property string $cron_minute
|
||||
* @property bool $is_active
|
||||
* @property bool $is_processing
|
||||
* @property \Carbon\Carbon|null $last_run_at
|
||||
* @property \Carbon\Carbon|null $next_run_at
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $hashid
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks
|
||||
*/
|
||||
class Schedule extends Model
|
||||
|
@ -34,7 +32,7 @@ class Schedule extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server_schedule';
|
||||
public const RESOURCE_NAME = 'server_schedule';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -7,49 +7,48 @@ use Illuminate\Database\Query\JoinClause;
|
|||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string|null $external_id
|
||||
* @property string $uuid
|
||||
* @property string $uuidShort
|
||||
* @property int $node_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property bool $skip_scripts
|
||||
* @property bool $suspended
|
||||
* @property int $owner_id
|
||||
* @property int $memory
|
||||
* @property int $swap
|
||||
* @property int $disk
|
||||
* @property int $io
|
||||
* @property int $cpu
|
||||
* @property string $threads
|
||||
* @property bool $oom_disabled
|
||||
* @property int $allocation_id
|
||||
* @property int $nest_id
|
||||
* @property int $egg_id
|
||||
* @property string $startup
|
||||
* @property string $image
|
||||
* @property int $installed
|
||||
* @property int $allocation_limit
|
||||
* @property int $database_limit
|
||||
* @property int $backup_limit
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers
|
||||
* @property \Pterodactyl\Models\Allocation $allocation
|
||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
* @property \Pterodactyl\Models\Nest $nest
|
||||
* @property \Pterodactyl\Models\Egg $egg
|
||||
* @property int $id
|
||||
* @property string|null $external_id
|
||||
* @property string $uuid
|
||||
* @property string $uuidShort
|
||||
* @property int $node_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property bool $skip_scripts
|
||||
* @property bool $suspended
|
||||
* @property int $owner_id
|
||||
* @property int $memory
|
||||
* @property int $swap
|
||||
* @property int $disk
|
||||
* @property int $io
|
||||
* @property int $cpu
|
||||
* @property string $threads
|
||||
* @property bool $oom_disabled
|
||||
* @property int $allocation_id
|
||||
* @property int $nest_id
|
||||
* @property int $egg_id
|
||||
* @property string $startup
|
||||
* @property string $image
|
||||
* @property int $installed
|
||||
* @property int $allocation_limit
|
||||
* @property int $database_limit
|
||||
* @property int $backup_limit
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers
|
||||
* @property \Pterodactyl\Models\Allocation $allocation
|
||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
* @property \Pterodactyl\Models\Nest $nest
|
||||
* @property \Pterodactyl\Models\Egg $egg
|
||||
* @property \Pterodactyl\Models\EggVariable[]|\Illuminate\Database\Eloquent\Collection $variables
|
||||
* @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule
|
||||
* @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases
|
||||
* @property \Pterodactyl\Models\Location $location
|
||||
* @property \Pterodactyl\Models\ServerTransfer $transfer
|
||||
* @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups
|
||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||
* @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule
|
||||
* @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases
|
||||
* @property \Pterodactyl\Models\Location $location
|
||||
* @property \Pterodactyl\Models\ServerTransfer $transfer
|
||||
* @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups
|
||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||
*/
|
||||
class Server extends Model
|
||||
{
|
||||
|
@ -60,11 +59,11 @@ class Server extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server';
|
||||
public const RESOURCE_NAME = 'server';
|
||||
|
||||
const STATUS_INSTALLING = 0;
|
||||
const STATUS_INSTALLED = 1;
|
||||
const STATUS_INSTALL_FAILED = 2;
|
||||
public const STATUS_INSTALLING = 0;
|
||||
public const STATUS_INSTALLED = 1;
|
||||
public const STATUS_INSTALL_FAILED = 2;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -159,8 +158,6 @@ class Server extends Model
|
|||
|
||||
/**
|
||||
* Returns the format for server allocations when communicating with the Daemon.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllocationMappings(): array
|
||||
{
|
||||
|
@ -169,9 +166,6 @@ class Server extends Model
|
|||
})->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInstalled(): bool
|
||||
{
|
||||
return $this->installed === 1;
|
||||
|
|
|
@ -3,22 +3,21 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property int $old_node
|
||||
* @property int $new_node
|
||||
* @property int $old_allocation
|
||||
* @property int $new_allocation
|
||||
* @property array|null $old_additional_allocations
|
||||
* @property array|null $new_additional_allocations
|
||||
* @property bool|null $successful
|
||||
* @property bool $archived
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property int $old_node
|
||||
* @property int $new_node
|
||||
* @property int $old_allocation
|
||||
* @property int $new_allocation
|
||||
* @property array|null $old_additional_allocations
|
||||
* @property array|null $new_additional_allocations
|
||||
* @property bool|null $successful
|
||||
* @property bool $archived
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\Node $oldNode
|
||||
* @property \Pterodactyl\Models\Node $newNode
|
||||
* @property \Pterodactyl\Models\Node $oldNode
|
||||
* @property \Pterodactyl\Models\Node $newNode
|
||||
*/
|
||||
class ServerTransfer extends Model
|
||||
{
|
||||
|
@ -26,7 +25,7 @@ class ServerTransfer extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server_transfer';
|
||||
public const RESOURCE_NAME = 'server_transfer';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -10,7 +10,7 @@ class ServerVariable extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server_variable';
|
||||
public const RESOURCE_NAME = 'server_variable';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -5,14 +5,13 @@ namespace Pterodactyl\Models;
|
|||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $server_id
|
||||
* @property array $permissions
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $server_id
|
||||
* @property array $permissions
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
*/
|
||||
class Subuser extends Model
|
||||
|
@ -23,7 +22,7 @@ class Subuser extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'server_subuser';
|
||||
public const RESOURCE_NAME = 'server_subuser';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
|
|
@ -7,20 +7,18 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
|||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $schedule_id
|
||||
* @property int $sequence_id
|
||||
* @property string $action
|
||||
* @property string $payload
|
||||
* @property int $time_offset
|
||||
* @property bool $is_queued
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property string $hashid
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $schedule_id
|
||||
* @property int $sequence_id
|
||||
* @property string $action
|
||||
* @property string $payload
|
||||
* @property int $time_offset
|
||||
* @property bool $is_queued
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $hashid
|
||||
* @property \Pterodactyl\Models\Schedule $schedule
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
*/
|
||||
class Task extends Model
|
||||
{
|
||||
|
@ -30,7 +28,7 @@ class Task extends Model
|
|||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'schedule_task';
|
||||
public const RESOURCE_NAME = 'schedule_task';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -119,6 +117,7 @@ class Task extends Model
|
|||
* Return the server a task is assigned to, acts as a belongsToThrough.
|
||||
*
|
||||
* @return \Znck\Eloquent\Relations\BelongsToThrough
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function server()
|
||||
|
|
|
@ -17,27 +17,26 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
|||
use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string|null $external_id
|
||||
* @property string $uuid
|
||||
* @property string $username
|
||||
* @property string $email
|
||||
* @property string|null $name_first
|
||||
* @property string|null $name_last
|
||||
* @property string $password
|
||||
* @property string|null $remeber_token
|
||||
* @property string $language
|
||||
* @property bool $root_admin
|
||||
* @property bool $use_totp
|
||||
* @property string|null $totp_secret
|
||||
* @property \Carbon\Carbon|null $totp_authenticated_at
|
||||
* @property bool $gravatar
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*
|
||||
* @property string $name
|
||||
* @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys
|
||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||
* @property int $id
|
||||
* @property string|null $external_id
|
||||
* @property string $uuid
|
||||
* @property string $username
|
||||
* @property string $email
|
||||
* @property string|null $name_first
|
||||
* @property string|null $name_last
|
||||
* @property string $password
|
||||
* @property string|null $remeber_token
|
||||
* @property string $language
|
||||
* @property bool $root_admin
|
||||
* @property bool $use_totp
|
||||
* @property string|null $totp_secret
|
||||
* @property \Carbon\Carbon|null $totp_authenticated_at
|
||||
* @property bool $gravatar
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $name
|
||||
* @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys
|
||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||
* @property \Pterodactyl\Models\RecoveryToken[]|\Illuminate\Database\Eloquent\Collection $recoveryTokens
|
||||
*/
|
||||
class User extends Model implements
|
||||
|
@ -51,14 +50,14 @@ class User extends Model implements
|
|||
use CanResetPassword;
|
||||
use Notifiable;
|
||||
|
||||
const USER_LEVEL_USER = 0;
|
||||
const USER_LEVEL_ADMIN = 1;
|
||||
public const USER_LEVEL_USER = 0;
|
||||
public const USER_LEVEL_ADMIN = 1;
|
||||
|
||||
/**
|
||||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'user';
|
||||
public const RESOURCE_NAME = 'user';
|
||||
|
||||
/**
|
||||
* Level of servers to display when using access() on a user.
|
||||
|
@ -157,16 +156,14 @@ class User extends Model implements
|
|||
{
|
||||
$rules = parent::getRules();
|
||||
|
||||
$rules['language'][] = new In(array_keys((new self)->getAvailableLanguages()));
|
||||
$rules['username'][] = new Username;
|
||||
$rules['language'][] = new In(array_keys((new self())->getAvailableLanguages()));
|
||||
$rules['username'][] = new Username();
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the user model in a format that can be passed over to Vue templates.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toVueObject(): array
|
||||
{
|
||||
|
@ -185,8 +182,6 @@ class User extends Model implements
|
|||
|
||||
/**
|
||||
* Store the username as a lowercase string.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setUsernameAttribute(string $value)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue