app: update models
This commit is contained in:
parent
28bc86e23b
commit
9d64c6751b
|
@ -48,7 +48,7 @@ class AdminRole extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'name' => 'required|string|max:64',
|
'name' => 'required|string|max:64',
|
||||||
'description' => 'nullable|string|max:255',
|
'description' => 'nullable|string|max:255',
|
||||||
'sort_id' => 'sometimes|numeric',
|
'sort_id' => 'sometimes|numeric',
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Allocation extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'node_id' => 'required|exists:nodes,id',
|
'node_id' => 'required|exists:nodes,id',
|
||||||
'ip' => 'required|ip',
|
'ip' => 'required|ip',
|
||||||
'port' => 'required|numeric|between:1024,65535',
|
'port' => 'required|numeric|between:1024,65535',
|
||||||
|
|
|
@ -97,7 +97,7 @@ class ApiKey extends Model
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'user_id' => 'required|exists:users,id',
|
'user_id' => 'required|exists:users,id',
|
||||||
'key_type' => 'present|integer|min:0|max:4',
|
'key_type' => 'present|integer|min:0|max:4',
|
||||||
'identifier' => 'required|string|size:16|unique:api_keys,identifier',
|
'identifier' => 'required|string|size:16|unique:api_keys,identifier',
|
||||||
|
|
|
@ -63,7 +63,7 @@ class AuditLog extends Model
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $immutableDates = true;
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Backup extends Model
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $immutableDates = true;
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -79,7 +79,7 @@ class Backup extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'server_id' => 'bail|required|numeric|exists:servers,id',
|
'server_id' => 'bail|required|numeric|exists:servers,id',
|
||||||
'uuid' => 'required|uuid',
|
'uuid' => 'required|uuid',
|
||||||
'is_successful' => 'boolean',
|
'is_successful' => 'boolean',
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Database extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $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',
|
||||||
'database' => 'required|string|alpha_dash|between:3,48',
|
'database' => 'required|string|alpha_dash|between:3,48',
|
||||||
|
|
|
@ -24,7 +24,7 @@ class DatabaseHost extends Model
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $immutableDates = true;
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Egg extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'nest_id' => 'required|bail|numeric|exists:nests,id',
|
'nest_id' => 'required|bail|numeric|exists:nests,id',
|
||||||
'uuid' => 'required|string|size:36',
|
'uuid' => 'required|string|size:36',
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
|
|
|
@ -40,7 +40,7 @@ class EggVariable extends Model
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $immutableDates = true;
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Location extends Model
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'short' => 'required|string|between:1,60|unique:locations,short',
|
'short' => 'required|string|between:1,60|unique:locations,short',
|
||||||
'long' => 'string|nullable|between:1,191',
|
'long' => 'string|nullable|between:1,191',
|
||||||
];
|
];
|
||||||
|
|
|
@ -20,7 +20,7 @@ abstract class Model extends IlluminateModel
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $immutableDates = false;
|
protected bool $immutableDates = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the model should undergo data validation before it is saved
|
* Determines if the model should undergo data validation before it is saved
|
||||||
|
@ -45,7 +45,7 @@ abstract class Model extends IlluminateModel
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [];
|
public static array $validationRules = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for the model saving event and fire off the validation
|
* Listen for the model saving event and fire off the validation
|
||||||
|
|
|
@ -52,10 +52,8 @@ class Mount extends Model
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'name' => 'required|string|min:2|max:64|unique:mounts,name',
|
'name' => 'required|string|min:2|max:64|unique:mounts,name',
|
||||||
'description' => 'nullable|string|max:191',
|
'description' => 'nullable|string|max:191',
|
||||||
'source' => 'required|string',
|
'source' => 'required|string',
|
||||||
|
|
|
@ -38,10 +38,7 @@ class Nest extends Model
|
||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public static array $validationRules = [
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $validationRules = [
|
|
||||||
'author' => 'sometimes|string|email',
|
'author' => 'sometimes|string|email',
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
|
|
|
@ -100,10 +100,7 @@ class Node extends Model
|
||||||
'description', 'maintenance_mode',
|
'description', 'maintenance_mode',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public static array $validationRules = [
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $validationRules = [
|
|
||||||
'name' => 'required|regex:/^([\w .-]{1,100})$/',
|
'name' => 'required|regex:/^([\w .-]{1,100})$/',
|
||||||
'description' => 'string|nullable',
|
'description' => 'string|nullable',
|
||||||
'location_id' => 'required|exists:locations,id',
|
'location_id' => 'required|exists:locations,id',
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Permission extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'subuser_id' => 'required|numeric|min:1',
|
'subuser_id' => 'required|numeric|min:1',
|
||||||
'permission' => 'required|string',
|
'permission' => 'required|string',
|
||||||
];
|
];
|
||||||
|
|
|
@ -21,15 +21,9 @@ class RecoveryToken extends Model
|
||||||
*/
|
*/
|
||||||
public $timestamps = true;
|
public $timestamps = true;
|
||||||
|
|
||||||
/**
|
protected bool $immutableDates = true;
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $immutableDates = true;
|
|
||||||
|
|
||||||
/**
|
public static array $validationRules = [
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
public static $validationRules = [
|
|
||||||
'token' => 'required|string',
|
'token' => 'required|string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,7 @@ class Schedule extends Model
|
||||||
'only_when_online' => false,
|
'only_when_online' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public static array $validationRules = [
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $validationRules = [
|
|
||||||
'server_id' => 'required|exists:servers,id',
|
'server_id' => 'required|exists:servers,id',
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
'cron_day_of_week' => 'required|string',
|
'cron_day_of_week' => 'required|string',
|
||||||
|
|
|
@ -107,10 +107,7 @@ class Server extends Model
|
||||||
*/
|
*/
|
||||||
protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, 'deleted_at'];
|
protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, 'deleted_at'];
|
||||||
|
|
||||||
/**
|
public static array $validationRules = [
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $validationRules = [
|
|
||||||
'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers',
|
'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers',
|
||||||
'owner_id' => 'required|integer|exists:users,id',
|
'owner_id' => 'required|integer|exists:users,id',
|
||||||
'name' => 'required|string|min:1|max:191',
|
'name' => 'required|string|min:1|max:191',
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ServerTransfer extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $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',
|
||||||
'new_node' => 'required|numeric',
|
'new_node' => 'required|numeric',
|
||||||
|
|
|
@ -20,23 +20,18 @@ class ServerVariable extends Model
|
||||||
*/
|
*/
|
||||||
public const RESOURCE_NAME = 'server_variable';
|
public const RESOURCE_NAME = 'server_variable';
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
protected $immutableDates = true;
|
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
protected $table = 'server_variables';
|
protected $table = 'server_variables';
|
||||||
|
|
||||||
/** @var string[] */
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/** @var string[] */
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'server_id' => 'integer',
|
'server_id' => 'integer',
|
||||||
'variable_id' => 'integer',
|
'variable_id' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var string[] */
|
public static array $validationRules = [
|
||||||
public static $validationRules = [
|
|
||||||
'server_id' => 'required|int',
|
'server_id' => 'required|int',
|
||||||
'variable_id' => 'required|int',
|
'variable_id' => 'required|int',
|
||||||
'variable_value' => 'string',
|
'variable_value' => 'string',
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Setting extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'key' => 'required|string|between:1,191',
|
'key' => 'required|string|between:1,191',
|
||||||
'value' => 'string',
|
'value' => 'string',
|
||||||
];
|
];
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Subuser extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $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',
|
||||||
'permissions' => 'nullable|array',
|
'permissions' => 'nullable|array',
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Task extends Model
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'schedule_id' => 'required|numeric|exists:schedules,id',
|
'schedule_id' => 'required|numeric|exists:schedules,id',
|
||||||
'sequence_id' => 'required|numeric|min:1',
|
'sequence_id' => 'required|numeric|min:1',
|
||||||
'action' => 'required|string',
|
'action' => 'required|string',
|
||||||
|
|
|
@ -138,7 +138,7 @@ class User extends Model implements
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static array $validationRules = [
|
||||||
'uuid' => 'required|string|size:36|unique:users,uuid',
|
'uuid' => 'required|string|size:36|unique:users,uuid',
|
||||||
'email' => 'required|email|between:1,191|unique:users,email',
|
'email' => 'required|email|between:1,191|unique:users,email',
|
||||||
'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id',
|
'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id',
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $id
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $public_key
|
||||||
|
* @property \Carbon\CarbonImmutable $created_at
|
||||||
|
*/
|
||||||
|
class UserSSHKey extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'user_ssh_keys';
|
||||||
|
protected bool $immutableDates = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $guarded = ['id', 'created_at'];
|
||||||
|
|
||||||
|
public static array $validationRules = [
|
||||||
|
'name' => 'required|string',
|
||||||
|
'public_key' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue