mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 04:04:45 +02:00
Use new method, property is deprecated
This commit is contained in:
parent
899b8836fb
commit
6d3da18bf6
@ -21,10 +21,10 @@ class APILog extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* Cast values to correct type.
|
{
|
||||||
*/
|
return [
|
||||||
protected $casts = [
|
'authorized' => 'boolean',
|
||||||
'authorized' => 'boolean',
|
];
|
||||||
];
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,6 @@ class ActivityLog extends Model
|
|||||||
'timestamp',
|
'timestamp',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'properties' => 'collection',
|
|
||||||
'timestamp' => 'datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $with = ['subjects'];
|
protected $with = ['subjects'];
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
@ -82,6 +77,14 @@ class ActivityLog extends Model
|
|||||||
'properties' => ['array'],
|
'properties' => ['array'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'properties' => 'collection',
|
||||||
|
'timestamp' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function actor(): MorphTo
|
public function actor(): MorphTo
|
||||||
{
|
{
|
||||||
$morph = $this->morphTo();
|
$morph = $this->morphTo();
|
||||||
|
@ -57,15 +57,6 @@ class Allocation extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'node_id' => 'integer',
|
|
||||||
'port' => 'integer',
|
|
||||||
'server_id' => 'integer',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'node_id' => 'required|exists:nodes,id',
|
'node_id' => 'required|exists:nodes,id',
|
||||||
'ip' => 'required|ip',
|
'ip' => 'required|ip',
|
||||||
@ -82,9 +73,15 @@ class Allocation extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* {@inheritDoc}
|
{
|
||||||
*/
|
return [
|
||||||
|
'node_id' => 'integer',
|
||||||
|
'port' => 'integer',
|
||||||
|
'server_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getRouteKeyName(): string
|
public function getRouteKeyName(): string
|
||||||
{
|
{
|
||||||
return $this->getKeyName();
|
return $this->getKeyName();
|
||||||
|
@ -88,25 +88,6 @@ class ApiKey extends Model
|
|||||||
*/
|
*/
|
||||||
protected $table = 'api_keys';
|
protected $table = 'api_keys';
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'allowed_ips' => 'array',
|
|
||||||
'user_id' => 'int',
|
|
||||||
'last_used_at' => 'datetime',
|
|
||||||
'expires_at' => 'datetime',
|
|
||||||
self::CREATED_AT => 'datetime',
|
|
||||||
self::UPDATED_AT => 'datetime',
|
|
||||||
'r_' . AdminAcl::RESOURCE_USERS => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_EGGS => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_NODES => 'int',
|
|
||||||
'r_' . AdminAcl::RESOURCE_SERVERS => 'int',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields that are mass assignable.
|
* Fields that are mass assignable.
|
||||||
*/
|
*/
|
||||||
@ -147,6 +128,25 @@ class ApiKey extends Model
|
|||||||
'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3',
|
'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'allowed_ips' => 'array',
|
||||||
|
'user_id' => 'int',
|
||||||
|
'last_used_at' => 'datetime',
|
||||||
|
'expires_at' => 'datetime',
|
||||||
|
self::CREATED_AT => 'datetime',
|
||||||
|
self::UPDATED_AT => 'datetime',
|
||||||
|
'r_' . AdminAcl::RESOURCE_USERS => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_EGGS => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_NODES => 'int',
|
||||||
|
'r_' . AdminAcl::RESOURCE_SERVERS => 'int',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the user this token is assigned to.
|
* Returns the user this token is assigned to.
|
||||||
*/
|
*/
|
||||||
|
@ -26,18 +26,21 @@ class AuditLog extends Model
|
|||||||
|
|
||||||
protected $table = 'audit_logs';
|
protected $table = 'audit_logs';
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'is_system' => 'bool',
|
|
||||||
'device' => 'array',
|
|
||||||
'metadata' => 'array',
|
|
||||||
'created_at' => 'immutable_datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $guarded = [
|
protected $guarded = [
|
||||||
'id',
|
'id',
|
||||||
'created_at',
|
'created_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'is_system' => 'bool',
|
||||||
|
'device' => 'array',
|
||||||
|
'metadata' => 'array',
|
||||||
|
'created_at' => 'immutable_datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
|
@ -36,18 +36,6 @@ class Backup extends Model
|
|||||||
|
|
||||||
protected $table = 'backups';
|
protected $table = 'backups';
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'id' => 'int',
|
|
||||||
'is_successful' => 'bool',
|
|
||||||
'is_locked' => 'bool',
|
|
||||||
'ignored_files' => 'array',
|
|
||||||
'bytes' => 'int',
|
|
||||||
'completed_at' => 'immutable_datetime',
|
|
||||||
'created_at' => 'immutable_datetime',
|
|
||||||
'updated_at' => 'immutable_datetime',
|
|
||||||
'deleted_at' => 'immutable_datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'is_successful' => false,
|
'is_successful' => false,
|
||||||
'is_locked' => false,
|
'is_locked' => false,
|
||||||
@ -71,6 +59,21 @@ class Backup extends Model
|
|||||||
'upload_id' => 'nullable|string',
|
'upload_id' => 'nullable|string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => 'int',
|
||||||
|
'is_successful' => 'bool',
|
||||||
|
'is_locked' => 'bool',
|
||||||
|
'ignored_files' => 'array',
|
||||||
|
'bytes' => 'int',
|
||||||
|
'completed_at' => 'immutable_datetime',
|
||||||
|
'created_at' => 'immutable_datetime',
|
||||||
|
'updated_at' => 'immutable_datetime',
|
||||||
|
'deleted_at' => 'immutable_datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function server(): BelongsTo
|
public function server(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Server::class);
|
return $this->belongsTo(Server::class);
|
||||||
|
@ -48,15 +48,6 @@ class Database extends Model
|
|||||||
'server_id', 'database_host_id', 'database', 'username', 'password', 'remote', 'max_connections',
|
'server_id', 'database_host_id', 'database', 'username', 'password', 'remote', 'max_connections',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'server_id' => 'integer',
|
|
||||||
'database_host_id' => 'integer',
|
|
||||||
'max_connections' => 'integer',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'server_id' => 'required|numeric|exists:servers,id',
|
'server_id' => 'required|numeric|exists:servers,id',
|
||||||
'database_host_id' => 'required|exists:database_hosts,id',
|
'database_host_id' => 'required|exists:database_hosts,id',
|
||||||
@ -67,9 +58,15 @@ class Database extends Model
|
|||||||
'password' => 'string',
|
'password' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* {@inheritDoc}
|
{
|
||||||
*/
|
return [
|
||||||
|
'server_id' => 'integer',
|
||||||
|
'database_host_id' => 'integer',
|
||||||
|
'max_connections' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getRouteKeyName(): string
|
public function getRouteKeyName(): string
|
||||||
{
|
{
|
||||||
return $this->getKeyName();
|
return $this->getKeyName();
|
||||||
|
@ -42,17 +42,6 @@ class DatabaseHost extends Model
|
|||||||
'name', 'host', 'port', 'username', 'password', 'max_databases', 'node_id',
|
'name', 'host', 'port', 'username', 'password', 'max_databases', 'node_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'id' => 'integer',
|
|
||||||
'max_databases' => 'integer',
|
|
||||||
'node_id' => 'integer',
|
|
||||||
'created_at' => 'immutable_datetime',
|
|
||||||
'updated_at' => 'immutable_datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation rules to assign to this model.
|
* Validation rules to assign to this model.
|
||||||
*/
|
*/
|
||||||
@ -65,6 +54,17 @@ class DatabaseHost extends Model
|
|||||||
'node_id' => 'sometimes|nullable|integer|exists:nodes,id',
|
'node_id' => 'sometimes|nullable|integer|exists:nodes,id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => 'integer',
|
||||||
|
'max_databases' => 'integer',
|
||||||
|
'node_id' => 'integer',
|
||||||
|
'created_at' => 'immutable_datetime',
|
||||||
|
'updated_at' => 'immutable_datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the node associated with a database host.
|
* Gets the node associated with a database host.
|
||||||
*/
|
*/
|
||||||
|
@ -99,19 +99,6 @@ class Egg extends Model
|
|||||||
'copy_script_from',
|
'copy_script_from',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'config_from' => 'integer',
|
|
||||||
'script_is_privileged' => 'boolean',
|
|
||||||
'force_outgoing_ip' => 'boolean',
|
|
||||||
'copy_script_from' => 'integer',
|
|
||||||
'features' => 'array',
|
|
||||||
'docker_images' => 'array',
|
|
||||||
'file_denylist' => 'array',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'uuid' => 'required|string|size:36',
|
'uuid' => 'required|string|size:36',
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
@ -142,6 +129,19 @@ class Egg extends Model
|
|||||||
'update_url' => null,
|
'update_url' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'config_from' => 'integer',
|
||||||
|
'script_is_privileged' => 'boolean',
|
||||||
|
'force_outgoing_ip' => 'boolean',
|
||||||
|
'copy_script_from' => 'integer',
|
||||||
|
'features' => 'array',
|
||||||
|
'docker_images' => 'array',
|
||||||
|
'file_denylist' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected static function booted(): void
|
protected static function booted(): void
|
||||||
{
|
{
|
||||||
static::deleting(function (self $egg) {
|
static::deleting(function (self $egg) {
|
||||||
|
@ -48,17 +48,6 @@ class EggVariable extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'egg_id' => 'integer',
|
|
||||||
'user_viewable' => 'bool',
|
|
||||||
'user_editable' => 'bool',
|
|
||||||
'created_at' => 'immutable_datetime',
|
|
||||||
'updated_at' => 'immutable_datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'egg_id' => 'exists:eggs,id',
|
'egg_id' => 'exists:eggs,id',
|
||||||
'name' => 'required|string|between:1,191',
|
'name' => 'required|string|between:1,191',
|
||||||
@ -75,6 +64,17 @@ class EggVariable extends Model
|
|||||||
'user_viewable' => 0,
|
'user_viewable' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'egg_id' => 'integer',
|
||||||
|
'user_viewable' => 'bool',
|
||||||
|
'user_editable' => 'bool',
|
||||||
|
'created_at' => 'immutable_datetime',
|
||||||
|
'updated_at' => 'immutable_datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getRequiredAttribute(): bool
|
public function getRequiredAttribute(): bool
|
||||||
{
|
{
|
||||||
return in_array('required', explode('|', $this->rules));
|
return in_array('required', explode('|', $this->rules));
|
||||||
|
@ -36,15 +36,6 @@ class Mount extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'uuid'];
|
protected $guarded = ['id', 'uuid'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Default values for specific fields in the database.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'id' => 'int',
|
|
||||||
'read_only' => 'bool',
|
|
||||||
'user_mountable' => 'bool',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rules verifying that the data being stored matches the expectations of the database.
|
* Rules verifying that the data being stored matches the expectations of the database.
|
||||||
*/
|
*/
|
||||||
@ -92,6 +83,15 @@ class Mount extends Model
|
|||||||
'/home/container',
|
'/home/container',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => 'int',
|
||||||
|
'read_only' => 'bool',
|
||||||
|
'user_mountable' => 'bool',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all eggs that have this mount assigned.
|
* Returns all eggs that have this mount assigned.
|
||||||
*/
|
*/
|
||||||
|
@ -60,19 +60,6 @@ class Node extends Model
|
|||||||
public int $sum_memory;
|
public int $sum_memory;
|
||||||
public int $sum_disk;
|
public int $sum_disk;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'memory' => 'integer',
|
|
||||||
'disk' => 'integer',
|
|
||||||
'daemonListen' => 'integer',
|
|
||||||
'daemonSFTP' => 'integer',
|
|
||||||
'behind_proxy' => 'boolean',
|
|
||||||
'public' => 'boolean',
|
|
||||||
'maintenance_mode' => 'boolean',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields that are mass assignable.
|
* Fields that are mass assignable.
|
||||||
*/
|
*/
|
||||||
@ -117,6 +104,19 @@ class Node extends Model
|
|||||||
'maintenance_mode' => false,
|
'maintenance_mode' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'memory' => 'integer',
|
||||||
|
'disk' => 'integer',
|
||||||
|
'daemonListen' => 'integer',
|
||||||
|
'daemonSFTP' => 'integer',
|
||||||
|
'behind_proxy' => 'boolean',
|
||||||
|
'public' => 'boolean',
|
||||||
|
'maintenance_mode' => 'boolean',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the connection address to use when making calls to this node.
|
* Get the connection address to use when making calls to this node.
|
||||||
*/
|
*/
|
||||||
|
@ -80,13 +80,6 @@ class Permission extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'subuser_id' => 'integer',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'subuser_id' => 'required|numeric|min:1',
|
'subuser_id' => 'required|numeric|min:1',
|
||||||
'permission' => 'required|string',
|
'permission' => 'required|string',
|
||||||
@ -208,6 +201,13 @@ class Permission extends Model
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'subuser_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the permissions available on the system for a user to
|
* Returns all the permissions available on the system for a user to
|
||||||
* have when controlling a server.
|
* have when controlling a server.
|
||||||
|
@ -65,16 +65,6 @@ class Schedule extends Model
|
|||||||
'next_run_at',
|
'next_run_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'id' => 'integer',
|
|
||||||
'server_id' => 'integer',
|
|
||||||
'is_active' => 'boolean',
|
|
||||||
'is_processing' => 'boolean',
|
|
||||||
'only_when_online' => 'boolean',
|
|
||||||
'last_run_at' => 'datetime',
|
|
||||||
'next_run_at' => 'datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'cron_day_of_week' => '*',
|
'cron_day_of_week' => '*',
|
||||||
@ -102,9 +92,19 @@ class Schedule extends Model
|
|||||||
'next_run_at' => 'nullable|date',
|
'next_run_at' => 'nullable|date',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* {@inheritDoc}
|
{
|
||||||
*/
|
return [
|
||||||
|
'id' => 'integer',
|
||||||
|
'server_id' => 'integer',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
'is_processing' => 'boolean',
|
||||||
|
'only_when_online' => 'boolean',
|
||||||
|
'last_run_at' => 'datetime',
|
||||||
|
'next_run_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getRouteKeyName(): string
|
public function getRouteKeyName(): string
|
||||||
{
|
{
|
||||||
return $this->getKeyName();
|
return $this->getKeyName();
|
||||||
|
@ -170,29 +170,29 @@ class Server extends Model
|
|||||||
'backup_limit' => 'present|nullable|integer|min:0',
|
'backup_limit' => 'present|nullable|integer|min:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* Cast values to correct type.
|
{
|
||||||
*/
|
return [
|
||||||
protected $casts = [
|
'node_id' => 'integer',
|
||||||
'node_id' => 'integer',
|
'skip_scripts' => 'boolean',
|
||||||
'skip_scripts' => 'boolean',
|
'owner_id' => 'integer',
|
||||||
'owner_id' => 'integer',
|
'memory' => 'integer',
|
||||||
'memory' => 'integer',
|
'swap' => 'integer',
|
||||||
'swap' => 'integer',
|
'disk' => 'integer',
|
||||||
'disk' => 'integer',
|
'io' => 'integer',
|
||||||
'io' => 'integer',
|
'cpu' => 'integer',
|
||||||
'cpu' => 'integer',
|
'oom_disabled' => 'boolean',
|
||||||
'oom_disabled' => 'boolean',
|
'allocation_id' => 'integer',
|
||||||
'allocation_id' => 'integer',
|
'egg_id' => 'integer',
|
||||||
'egg_id' => 'integer',
|
'database_limit' => 'integer',
|
||||||
'database_limit' => 'integer',
|
'allocation_limit' => 'integer',
|
||||||
'allocation_limit' => 'integer',
|
'backup_limit' => 'integer',
|
||||||
'backup_limit' => 'integer',
|
self::CREATED_AT => 'datetime',
|
||||||
self::CREATED_AT => 'datetime',
|
self::UPDATED_AT => 'datetime',
|
||||||
self::UPDATED_AT => 'datetime',
|
'deleted_at' => 'datetime',
|
||||||
'deleted_at' => 'datetime',
|
'installed_at' => 'datetime',
|
||||||
'installed_at' => 'datetime',
|
];
|
||||||
];
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the format for server allocations when communicating with the Daemon.
|
* Returns the format for server allocations when communicating with the Daemon.
|
||||||
|
@ -40,21 +40,6 @@ class ServerTransfer extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'server_id' => 'int',
|
|
||||||
'old_node' => 'int',
|
|
||||||
'new_node' => 'int',
|
|
||||||
'old_allocation' => 'int',
|
|
||||||
'new_allocation' => 'int',
|
|
||||||
'old_additional_allocations' => 'array',
|
|
||||||
'new_additional_allocations' => 'array',
|
|
||||||
'successful' => 'bool',
|
|
||||||
'archived' => 'bool',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'server_id' => 'required|numeric|exists:servers,id',
|
'server_id' => 'required|numeric|exists:servers,id',
|
||||||
'old_node' => 'required|numeric',
|
'old_node' => 'required|numeric',
|
||||||
@ -68,6 +53,21 @@ class ServerTransfer extends Model
|
|||||||
'successful' => 'sometimes|nullable|boolean',
|
'successful' => 'sometimes|nullable|boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'server_id' => 'int',
|
||||||
|
'old_node' => 'int',
|
||||||
|
'new_node' => 'int',
|
||||||
|
'old_allocation' => 'int',
|
||||||
|
'new_allocation' => 'int',
|
||||||
|
'old_additional_allocations' => 'array',
|
||||||
|
'new_additional_allocations' => 'array',
|
||||||
|
'successful' => 'bool',
|
||||||
|
'archived' => 'bool',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server associated with a server transfer.
|
* Gets the server associated with a server transfer.
|
||||||
*/
|
*/
|
||||||
|
@ -26,19 +26,22 @@ class ServerVariable extends Model
|
|||||||
|
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'server_id' => 'integer',
|
|
||||||
'variable_id' => 'integer',
|
|
||||||
'created_at' => 'immutable_datetime',
|
|
||||||
'updated_at' => 'immutable_datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'server_id' => 'required|int',
|
'server_id' => 'required|int',
|
||||||
'variable_id' => 'required|int',
|
'variable_id' => 'required|int',
|
||||||
'variable_value' => 'string',
|
'variable_value' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'server_id' => 'integer',
|
||||||
|
'variable_id' => 'integer',
|
||||||
|
'created_at' => 'immutable_datetime',
|
||||||
|
'updated_at' => 'immutable_datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the server this variable is associated with.
|
* Returns the server this variable is associated with.
|
||||||
*/
|
*/
|
||||||
|
@ -11,11 +11,11 @@ class Session extends Model
|
|||||||
*/
|
*/
|
||||||
protected $table = 'sessions';
|
protected $table = 'sessions';
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* Cast values to correct type.
|
{
|
||||||
*/
|
return [
|
||||||
protected $casts = [
|
'id' => 'string',
|
||||||
'id' => 'string',
|
'user_id' => 'integer',
|
||||||
'user_id' => 'integer',
|
];
|
||||||
];
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,15 +36,6 @@ class Subuser extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'user_id' => 'int',
|
|
||||||
'server_id' => 'int',
|
|
||||||
'permissions' => 'array',
|
|
||||||
];
|
|
||||||
|
|
||||||
public static array $validationRules = [
|
public static array $validationRules = [
|
||||||
'user_id' => 'required|numeric|exists:users,id',
|
'user_id' => 'required|numeric|exists:users,id',
|
||||||
'server_id' => 'required|numeric|exists:servers,id',
|
'server_id' => 'required|numeric|exists:servers,id',
|
||||||
@ -52,6 +43,15 @@ class Subuser extends Model
|
|||||||
'permissions.*' => 'string',
|
'permissions.*' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'user_id' => 'int',
|
||||||
|
'server_id' => 'int',
|
||||||
|
'permissions' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a hashid encoded string to represent the ID of the subuser.
|
* Return a hashid encoded string to represent the ID of the subuser.
|
||||||
*/
|
*/
|
||||||
|
@ -62,18 +62,6 @@ class Task extends Model
|
|||||||
'continue_on_failure',
|
'continue_on_failure',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'id' => 'integer',
|
|
||||||
'schedule_id' => 'integer',
|
|
||||||
'sequence_id' => 'integer',
|
|
||||||
'time_offset' => 'integer',
|
|
||||||
'is_queued' => 'boolean',
|
|
||||||
'continue_on_failure' => 'boolean',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default attributes when creating a new model.
|
* Default attributes when creating a new model.
|
||||||
*/
|
*/
|
||||||
@ -93,9 +81,18 @@ class Task extends Model
|
|||||||
'continue_on_failure' => 'boolean',
|
'continue_on_failure' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* {@inheritDoc}
|
{
|
||||||
*/
|
return [
|
||||||
|
'id' => 'integer',
|
||||||
|
'schedule_id' => 'integer',
|
||||||
|
'sequence_id' => 'integer',
|
||||||
|
'time_offset' => 'integer',
|
||||||
|
'is_queued' => 'boolean',
|
||||||
|
'continue_on_failure' => 'boolean',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getRouteKeyName(): string
|
public function getRouteKeyName(): string
|
||||||
{
|
{
|
||||||
return $this->getKeyName();
|
return $this->getKeyName();
|
||||||
|
@ -16,15 +16,15 @@ class TaskLog extends Model
|
|||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
protected function casts(): array
|
||||||
* Cast values to correct type.
|
{
|
||||||
*/
|
return [
|
||||||
protected $casts = [
|
'id' => 'integer',
|
||||||
'id' => 'integer',
|
'task_id' => 'integer',
|
||||||
'task_id' => 'integer',
|
'run_status' => 'integer',
|
||||||
'run_status' => 'integer',
|
'run_time' => 'datetime',
|
||||||
'run_time' => 'datetime',
|
'created_at' => 'datetime',
|
||||||
'created_at' => 'datetime',
|
'updated_at' => 'datetime',
|
||||||
'updated_at' => 'datetime',
|
];
|
||||||
];
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,16 +125,6 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||||||
'root_admin',
|
'root_admin',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast values to correct type.
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
|
||||||
'root_admin' => 'boolean',
|
|
||||||
'use_totp' => 'boolean',
|
|
||||||
'gravatar' => 'boolean',
|
|
||||||
'totp_authenticated_at' => 'datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes excluded from the model's JSON form.
|
* The attributes excluded from the model's JSON form.
|
||||||
*/
|
*/
|
||||||
@ -168,6 +158,16 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||||||
'totp_secret' => 'nullable|string',
|
'totp_secret' => 'nullable|string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'root_admin' => 'boolean',
|
||||||
|
'use_totp' => 'boolean',
|
||||||
|
'gravatar' => 'boolean',
|
||||||
|
'totp_authenticated_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected static function booted(): void
|
protected static function booted(): void
|
||||||
{
|
{
|
||||||
static::deleting(function (self $user) {
|
static::deleting(function (self $user) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user