🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 20:46:38 +01:00
parent aca923992a
commit 6a72aef110
6 changed files with 27 additions and 1 deletions
@@ -10,6 +10,9 @@ class WebsitePaypalTransaction extends Model
{
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
@@ -13,6 +13,9 @@ class WebsiteShopArticle extends Model
{
protected $guarded = ['id'];
/**
* @return Collection<int, ItemBase>
*/
public function furniItems(): Collection
{
if (! $this->furniture) {
@@ -20,16 +23,27 @@ class WebsiteShopArticle extends Model
}
$furniture = json_decode($this->furniture, true);
if (! is_array($furniture)) {
return collect();
}
$furnitureIds = array_column($furniture, 'item_id');
return ItemBase::whereIn('id', $furnitureIds)->get();
}
/**
* @return HasOne<Permission, $this>
*/
public function rank(): HasOne
{
return $this->hasOne(Permission::class, 'id', 'give_rank');
}
/**
* @return HasMany<WebsiteShopArticleFeature, $this>
*/
public function features(): HasMany
{
return $this->HasMany(WebsiteShopArticleFeature::class, 'article_id', 'id');
@@ -9,6 +9,9 @@ class WebsiteShopArticleFeature extends Model
{
protected $guarded = ['id'];
/**
* @return BelongsTo<WebsiteShopArticle, $this>
*/
public function article(): BelongsTo
{
return $this->belongsTo(WebsiteShopArticle::class, 'article_id', 'id');
@@ -9,6 +9,9 @@ class WebsiteShopCategory extends Model
{
protected $guarded = [];
/**
* @return HasMany<WebsiteShopArticle, $this>
*/
public function articles(): HasMany
{
return $this->hasMany(WebsiteShopArticle::class);
@@ -9,6 +9,9 @@ class WebsiteUsedShopVoucher extends Model
{
protected $guarded = ['id'];
/**
* @return HasMany<WebsiteUsedShopVoucher, $this>
*/
public function used(): HasMany
{
return $this->hasMany(WebsiteUsedShopVoucher::class, 'voucher_id');
+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'));
if (! str_starts_with($adsPicturePath, 'http')) {
$adsPicturePath = rtrim((string) config('app.url'), '/') . '/' . ltrim($adsPicturePath, '/');
$adsPicturePath = rtrim((string) (config('app.url') ?? ''), '/') . '/' . ltrim($adsPicturePath, '/');
}
return rtrim($adsPicturePath, '/') . '/' . $this->image;
});