You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Fix more errors php stan 🆙
This commit is contained in:
@@ -41,6 +41,32 @@ use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $username
|
||||
* @property string $mail
|
||||
* @property string $password
|
||||
* @property string $look
|
||||
* @property string $motto
|
||||
* @property int $credits
|
||||
* @property int $rank
|
||||
* @property string $ip_register
|
||||
* @property string $ip_current
|
||||
* @property int $account_created
|
||||
* @property int $last_login
|
||||
* @property int $last_online
|
||||
* @property string|null $auth_ticket
|
||||
* @property int $home_room
|
||||
* @property string|null $referral_code
|
||||
* @property bool $online
|
||||
* @property bool $hidden_staff
|
||||
* @property int|null $team_id
|
||||
* @property string|null $two_factor_secret
|
||||
* @property string|null $two_factor_recovery_codes
|
||||
* @property \Illuminate\Support\Carbon|null $two_factor_confirmed_at
|
||||
* @property string|null $remember_token
|
||||
* @property \Illuminate\Support\Carbon|null $email_verified_at
|
||||
*/
|
||||
class User extends Authenticatable implements FilamentUser, HasName
|
||||
{
|
||||
use HasApiTokens, HasFactory, LogsActivity, Notifiable, TwoFactorAuthenticatable;
|
||||
@@ -66,12 +92,12 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
return $this->hasMany(UserCurrency::class, 'user_id');
|
||||
}
|
||||
|
||||
public function sessions()
|
||||
public function sessions(): HasMany
|
||||
{
|
||||
return $this->hasMany(Session::class);
|
||||
}
|
||||
|
||||
public function currency(string $currency)
|
||||
public function currency(string $currency): int
|
||||
{
|
||||
if (! $this->relationLoaded('currencies')) {
|
||||
$this->load('currencies');
|
||||
@@ -81,9 +107,10 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
'duckets' => 0,
|
||||
'diamonds' => 5,
|
||||
'points' => 101,
|
||||
default => 0,
|
||||
};
|
||||
|
||||
return $this->currencies->where('type', $type)->first()->amount ?? 0;
|
||||
return $this->currencies->where('type', $type)->first()?->amount ?? 0;
|
||||
}
|
||||
|
||||
public function permission(): HasOne
|
||||
@@ -126,7 +153,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
return $this->hasMany(MessengerFriendship::class, 'user_one_id');
|
||||
}
|
||||
|
||||
public function referralsNeeded()
|
||||
public function referralsNeeded(): int
|
||||
{
|
||||
$referrals = 0;
|
||||
|
||||
@@ -134,7 +161,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
$referrals = $this->referrals->referrals_total;
|
||||
}
|
||||
|
||||
return setting('referrals_needed') - $referrals;
|
||||
return (int) setting('referrals_needed') - $referrals;
|
||||
}
|
||||
|
||||
public function ban(): HasOne
|
||||
@@ -222,17 +249,20 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
return $this->hasMany(WebsiteUserGuestbook::class, 'user_id');
|
||||
}
|
||||
|
||||
public function chatLogs()
|
||||
public function chatLogs(): HasMany
|
||||
{
|
||||
return $this->hasMany(ChatlogRoom::class, 'user_from_id');
|
||||
}
|
||||
|
||||
public function chatLogsPrivate()
|
||||
public function chatLogsPrivate(): HasMany
|
||||
{
|
||||
return $this->hasMany(ChatlogPrivate::class, 'user_from_id');
|
||||
}
|
||||
|
||||
public function getOnlineFriends(int $total = 10)
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Collection<int, MessengerFriendship>
|
||||
*/
|
||||
public function getOnlineFriends(int $total = 10): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
return $this->friends()
|
||||
->select(['user_two_id', 'users.id', 'users.username', 'users.look', 'users.motto', 'users.last_online'])
|
||||
@@ -243,7 +273,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
->get();
|
||||
}
|
||||
|
||||
public function confirmTwoFactorAuthentication($code)
|
||||
public function confirmTwoFactorAuthentication(string $code): void
|
||||
{
|
||||
$codeIsValid = app(TwoFactorAuthenticationProvider::class)
|
||||
->verify(decrypt($this->two_factor_secret), $code);
|
||||
|
||||
Reference in New Issue
Block a user