orderBy('id', 'desc'); } public function scopeAlphavit(Builder $query): Builder { return $query->orderBy('name', 'asc'); } public function permissions(): hasMany { return $this->hasMany(RolePermission::class, 'role_id', 'id'); } protected function isRemove(): Attribute { return Attribute::make( get: fn ($dontRemove) => ( SystemRoleEnum::tryFrom($this->code) === null ), )->shouldCache(); } protected function isAdmin(): Attribute { return Attribute::make( get: fn () => ( $this->code === SystemRoleEnum::Admin->value ), )->shouldCache(); } }