'datetime','password'=>'hashed','is_private'=>'boolean','is_admin'=>'boolean']; public function getRouteKeyName(): string { return 'username'; } public function library(): HasMany { return $this->hasMany(UserGame::class); } public function reviews(): HasMany { return $this->hasMany(Review::class); } public function lists(): HasMany { return $this->hasMany(UserList::class); } public function activities(): HasMany { return $this->hasMany(Activity::class)->latest(); } public function notifications(): HasMany { return $this->hasMany(Notification::class)->latest('created_at'); } public function following(): BelongsToMany { return $this->belongsToMany(User::class, 'follows', 'follower_id', 'following_id')->withTimestamps(); } public function followers(): BelongsToMany { return $this->belongsToMany(User::class, 'follows', 'following_id', 'follower_id')->withTimestamps(); } public function isFollowing(User $user): bool { return $this->following()->where('following_id', $user->id)->exists(); } public function gameEntry(int $gameId): ?UserGame { return $this->library()->where('game_id', $gameId)->first(); } }