Wire admin studio SSR and search infrastructure

This commit is contained in:
2026-05-01 11:46:06 +02:00
parent 257b0dbef6
commit 18cea8b0f0
329 changed files with 197465 additions and 2741 deletions

View File

@@ -265,6 +265,11 @@ class User extends Authenticatable
return $this->hasMany(UserActivity::class, 'user_id');
}
public function worldRewardGrants(): HasMany
{
return $this->hasMany(WorldRewardGrant::class, 'user_id')->orderByDesc('granted_at')->orderByDesc('id');
}
public function achievements(): BelongsToMany
{
return $this->belongsToMany(Achievement::class, 'user_achievements', 'user_id', 'achievement_id')
@@ -385,6 +390,25 @@ class User extends Authenticatable
return $this->hasRole('admin') || $this->hasLegacyPrivilegeFlag('isAdmin');
}
public function isManager(): bool
{
return $this->hasRole('manager');
}
public function isEditorial(): bool
{
return $this->hasRole('editorial');
}
/**
* Returns true for any role that grants access to the /admin panel
* (admin, manager, editorial).
*/
public function hasStaffAccess(): bool
{
return $this->isAdmin() || $this->isManager() || $this->isEditorial();
}
public function isModerator(): bool
{
return $this->hasRole('moderator') || $this->hasLegacyPrivilegeFlag('isModerator');