forked from Alex/Pterodactyl-Panel
Fix casts on models; closes #49
This commit is contained in:
parent
fa6a535349
commit
d6bd7e7a2e
@ -42,6 +42,15 @@ class APIPermission extends Model
|
||||
*/
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'key_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Disable timestamps for this table.
|
||||
*
|
||||
|
@ -42,4 +42,15 @@ class Allocation extends Model
|
||||
*/
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'node' => 'integer',
|
||||
'port' => 'integer',
|
||||
'assigned_to' => 'integer',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,20 @@ class Node extends Model
|
||||
*/
|
||||
protected $hidden = ['daemonSecret'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'public' => 'integer',
|
||||
'location' => 'integer',
|
||||
'memory' => 'integer',
|
||||
'disk' => 'integer',
|
||||
'daemonListen' => 'integer',
|
||||
'daemonSFTP' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Fields that are not mass assignable.
|
||||
*
|
||||
|
@ -42,6 +42,16 @@ class Permission extends Model
|
||||
*/
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'user_id' => 'integer',
|
||||
'server_id' => 'integer',
|
||||
];
|
||||
|
||||
public function scopePermission($query, $permission)
|
||||
{
|
||||
return $query->where('permission', $permission);
|
||||
|
@ -52,6 +52,27 @@ class Server extends Model
|
||||
*/
|
||||
protected $guarded = ['id', 'installed', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'node' => 'integer',
|
||||
'active' => 'integer',
|
||||
'owner' => 'integer',
|
||||
'memory' => 'integer',
|
||||
'swap' => 'integer',
|
||||
'disk' => 'integer',
|
||||
'io' => 'integer',
|
||||
'cpu' => 'integer',
|
||||
'oom_disabled' => 'integer',
|
||||
'port' => 'integer',
|
||||
'service' => 'integer',
|
||||
'option' => 'integer',
|
||||
'installed' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
@ -42,4 +42,14 @@ class ServerVariables extends Model
|
||||
*/
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'server_id' => 'integer',
|
||||
'variable_id' => 'integer',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -35,4 +35,13 @@ class ServiceOptions extends Model
|
||||
*/
|
||||
protected $table = 'service_options';
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'parent_service' => 'integer',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -35,4 +35,16 @@ class ServiceVariables extends Model
|
||||
*/
|
||||
protected $table = 'service_variables';
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'option_id' => 'integer',
|
||||
'user_viewable' => 'integer',
|
||||
'user_editable' => 'integer',
|
||||
'required' => 'integer',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,16 @@ class Subuser extends Model
|
||||
*/
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'user_id' => 'integer',
|
||||
'server_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
|
@ -57,6 +57,16 @@ class User extends Model implements AuthenticatableContract,
|
||||
*/
|
||||
protected $guarded = ['id', 'remeber_token', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'root_admin' => 'integer',
|
||||
'use_totp' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user