admin(roles): add has one on User -> AdminRole
This commit is contained in:
parent
9d005b5fd2
commit
1e61fd161c
4 changed files with 70 additions and 1 deletions
|
@ -7,6 +7,7 @@ namespace Pterodactyl\Models;
|
|||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property int $sort_id
|
||||
* @property array $permissions
|
||||
*/
|
||||
class AdminRole extends Model
|
||||
{
|
||||
|
@ -33,6 +34,16 @@ class AdminRole extends Model
|
|||
'description',
|
||||
];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'sort_id' => 'int',
|
||||
'permissions' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
@ -45,4 +56,14 @@ class AdminRole extends Model
|
|||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Gets the permissions associated with a admin role.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function permissions()
|
||||
{
|
||||
return $this->hasMany(Permission::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue