misc_pterodactyl-panel/app/Models/AdminRole.php

72 lines
1.4 KiB
PHP
Raw Normal View History

2020-10-04 20:25:58 +00:00
<?php
namespace Pterodactyl\Models;
/**
* @property int $id
* @property string $name
* @property string|null $description
* @property int $sort_id
* @property array $permissions
2020-10-04 20:25:58 +00:00
*/
class AdminRole extends Model
{
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
*/
2021-03-05 15:46:14 +00:00
public const RESOURCE_NAME = 'admin_role';
2020-10-04 20:25:58 +00:00
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'admin_roles';
/**
* Fields that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'description',
2021-03-05 15:46:14 +00:00
'sort_id',
2020-10-04 20:25:58 +00:00
];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'sort_id' => 'int',
'permissions' => 'array',
];
2020-10-04 20:25:58 +00:00
/**
* @var array
*/
2021-07-17 21:18:05 +00:00
public static array $validationRules = [
2020-10-04 20:25:58 +00:00
'name' => 'required|string|max:64',
'description' => 'nullable|string|max:255',
2021-03-05 15:46:14 +00:00
'sort_id' => 'sometimes|numeric',
2020-10-04 20:25:58 +00:00
];
/**
* @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);
}
2020-10-04 20:25:58 +00:00
}