Files
Epicnabbo-Catalogus-Updated…/Updated_Cms/app/Models/Game/Permission.php
T
Remco eb55c3ab68 🆙 More fixes 🆙
2026-01-20 19:44:22 +01:00

58 lines
1.3 KiB
PHP

<?php
namespace App\Models\Game;
use App\Models\Compositions\HasBadge;
use App\Models\Community\Staff\WebsiteStaffApplications;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property int $id
* @property string $rank_name
* @property string $badge
* @property string|null $description
* @property string|null $prefix_color
* @property bool $hidden_rank
*/
class Permission extends Model implements HasBadge
{
protected $table = 'permissions';
public $timestamps = false;
protected $guarded = ['id', 'rank_name'];
/**
* @return HasMany<User, $this>
*/
public function users(): HasMany
{
return $this->hasMany(User::class, 'rank', 'id');
}
// public function roles(): HasMany
// {
// return $this->hasMany(PermissionRole::class);
// }
/**
* @return HasMany<WebsiteStaffApplications, $this>
*/
public function staffApplications(): HasMany
{
return $this->hasMany(WebsiteStaffApplications::class, 'rank_id');
}
public function getBadgePath(): string
{
return sprintf('%s%s.gif', setting('badges_path'), $this->getBadgeName());
}
public function getBadgeName(): string
{
return $this->badge;
}
}