🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 20:50:18 +01:00
parent b983f325f4
commit 93d3067306
5 changed files with 21 additions and 8 deletions
@@ -14,6 +14,9 @@ class PasswordResetToken extends Model
// timestamps = true, but we don't have "UPDATED_AT". To prevent an error, we set the default value to `null`. // timestamps = true, but we don't have "UPDATED_AT". To prevent an error, we set the default value to `null`.
public const UPDATED_AT = null; public const UPDATED_AT = null;
/**
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo public function user(): BelongsTo
{ {
return $this->belongsTo(User::class, 'email', 'mail'); return $this->belongsTo(User::class, 'email', 'mail');
+8 -4
View File
@@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use App\Models\User\UserItem; use App\Models\Game\Furniture\Item;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -10,20 +10,24 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Room extends Model class Room extends Model
{ {
use HasFactory;
protected $guarded = []; protected $guarded = [];
public $timestamps = false; public $timestamps = false;
/**
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo public function user(): BelongsTo
{ {
return $this->belongsTo(User::class, 'owner_id'); return $this->belongsTo(User::class, 'owner_id');
} }
/**
* @return HasMany<Item, $this>
*/
public function items(): HasMany public function items(): HasMany
{ {
return $this->hasMany(UserItem::class); return $this->hasMany(Item::class);
} }
public function replicateForUser(User $user): self public function replicateForUser(User $user): self
@@ -19,13 +19,13 @@ class WebsiteShopArticle extends Model
public function furniItems(): Collection public function furniItems(): Collection
{ {
if (! $this->furniture) { if (! $this->furniture) {
return collect(); return new Collection();
} }
$furniture = json_decode($this->furniture, true); $furniture = json_decode($this->furniture, true);
if (! is_array($furniture)) { if (! is_array($furniture)) {
return collect(); return new Collection();
} }
$furnitureIds = array_column($furniture, 'item_id'); $furnitureIds = array_column($furniture, 'item_id');
+7 -1
View File
@@ -365,8 +365,14 @@ class User extends Authenticatable implements FilamentUser, HasName
return false; return false;
} }
$decrypted = decrypt($secret);
if (! is_string($decrypted)) {
return false;
}
$codeIsValid = app(TwoFactorAuthenticationProvider::class) $codeIsValid = app(TwoFactorAuthenticationProvider::class)
->verify((string) decrypt($secret), $code); ->verify($decrypted, $code);
if (! $codeIsValid) { if (! $codeIsValid) {
return false; return false;
+1 -1
View File
@@ -29,7 +29,7 @@ class WebsiteAd extends Model
$adsPicturePath = Cache::remember('ads_picture_path', 3600, fn () => $settingsService->getOrDefault('ads_picture_path')); $adsPicturePath = Cache::remember('ads_picture_path', 3600, fn () => $settingsService->getOrDefault('ads_picture_path'));
if (! str_starts_with($adsPicturePath, 'http')) { if (! str_starts_with($adsPicturePath, 'http')) {
$adsPicturePath = rtrim((string) (config('app.url') ?? ''), '/') . '/' . ltrim($adsPicturePath, '/'); $adsPicturePath = rtrim(strval(config('app.url') ?? ''), '/') . '/' . ltrim($adsPicturePath, '/');
} }
return rtrim($adsPicturePath, '/') . '/' . $this->image; return rtrim($adsPicturePath, '/') . '/' . $this->image;
}); });