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