update
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use App\Models\SocialAccount;
|
||||
@@ -12,6 +13,9 @@ use App\Models\Conversation;
|
||||
use App\Models\ConversationParticipant;
|
||||
use App\Models\Message;
|
||||
use App\Models\Notification;
|
||||
use App\Models\Achievement;
|
||||
use App\Models\UserAchievement;
|
||||
use App\Models\UserXpLog;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@@ -50,6 +54,9 @@ class User extends Authenticatable
|
||||
'spam_reports',
|
||||
'approved_posts',
|
||||
'flagged_posts',
|
||||
'xp',
|
||||
'level',
|
||||
'rank',
|
||||
'password',
|
||||
'role',
|
||||
'allow_messages_from',
|
||||
@@ -88,6 +95,9 @@ class User extends Authenticatable
|
||||
'spam_reports' => 'integer',
|
||||
'approved_posts' => 'integer',
|
||||
'flagged_posts' => 'integer',
|
||||
'xp' => 'integer',
|
||||
'level' => 'integer',
|
||||
'rank' => 'string',
|
||||
'password' => 'hashed',
|
||||
'allow_messages_from' => 'string',
|
||||
];
|
||||
@@ -108,6 +118,16 @@ class User extends Authenticatable
|
||||
return $this->hasOne(UserProfile::class, 'user_id');
|
||||
}
|
||||
|
||||
public function dashboardPreference(): HasOne
|
||||
{
|
||||
return $this->hasOne(DashboardPreference::class, 'user_id');
|
||||
}
|
||||
|
||||
public function country(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function statistics(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserStatistic::class, 'user_id');
|
||||
@@ -140,6 +160,22 @@ class User extends Authenticatable
|
||||
return $this->hasMany(ProfileComment::class, 'profile_user_id');
|
||||
}
|
||||
|
||||
public function xpLogs(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserXpLog::class, 'user_id');
|
||||
}
|
||||
|
||||
public function userAchievements(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserAchievement::class, 'user_id');
|
||||
}
|
||||
|
||||
public function achievements(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Achievement::class, 'user_achievements', 'user_id', 'achievement_id')
|
||||
->withPivot('unlocked_at');
|
||||
}
|
||||
|
||||
// ── Messaging ────────────────────────────────────────────────────────────
|
||||
|
||||
public function conversations(): BelongsToMany
|
||||
|
||||
Reference in New Issue
Block a user