Wire admin studio SSR and search infrastructure
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user