🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 20:56:16 +01:00
parent 4a359a4fc9
commit f2ba190a47
7 changed files with 32 additions and 8 deletions
@@ -15,16 +15,25 @@ class WebsiteHelpCenterTicket extends Model
public $timestamps = false;
/**
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* @return BelongsTo<WebsiteHelpCenterCategory, $this>
*/
public function category(): BelongsTo
{
return $this->belongsTo(WebsiteHelpCenterCategory::class);
}
/**
* @return HasMany<WebsiteHelpCenterTicketReply, $this>
*/
public function replies(): HasMany
{
return $this->hasMany(WebsiteHelpCenterTicketReply::class, 'ticket_id');
@@ -50,8 +59,11 @@ class WebsiteHelpCenterTicket extends Model
return $this->open || hasPermission('manage_website_tickets');
}
/**
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function content(): \Illuminate\Database\Eloquent\Casts\Attribute
{
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: fn($value) => Purify::clean($value));
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: fn ($value) => Purify::clean((string) $value));
}
}
@@ -27,8 +27,11 @@ class WebsiteHelpCenterTicketReply extends Model
return $this->user_id === Auth::id() || hasPermission('delete_website_ticket_replies');
}
/**
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function content(): \Illuminate\Database\Eloquent\Casts\Attribute
{
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: fn($value) => Purify::clean($value));
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: fn ($value) => Purify::clean((string) $value));
}
}
@@ -9,6 +9,9 @@ class WebsiteRule extends Model
{
protected $guarded = [];
/**
* @return BelongsTo<WebsiteRuleCategory, $this>
*/
public function category(): BelongsTo
{
return $this->belongsTo(WebsiteRuleCategory::class, 'category_id');
@@ -9,6 +9,9 @@ class WebsiteRuleCategory extends Model
{
protected $guarded = [];
/**
* @return HasMany<WebsiteRule, $this>
*/
public function rules(): HasMany
{
return $this->hasMany(WebsiteRule::class, 'category_id');
+5 -5
View File
@@ -2,19 +2,19 @@
namespace App\Models;
use App\Models\User\UserItem;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Game\Furniture\Item;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ItemDefinition extends Model
{
use HasFactory;
protected $table = 'items_base';
/**
* @return HasMany<Item, $this>
*/
public function userItems(): HasMany
{
return $this->hasMany(UserItem::class, 'item_id');
return $this->hasMany(Item::class, 'item_id');
}
}
@@ -72,6 +72,7 @@ class CameraWeb extends Model
*/
protected function formattedDate(): Attribute
{
/** @var Attribute<string, never> */
return new Attribute(
get: fn () => \Illuminate\Support\Facades\Date::parse($this->timestamp)->format('Y-m-d H:i'),
);
+3 -1
View File
@@ -119,7 +119,9 @@ class User extends Authenticatable implements FilamentUser, HasName
default => 0,
};
return $this->currencies->where('type', $type)->first()?->amount ?? 0;
$currency = $this->currencies->where('type', $type)->first();
return $currency ? $currency->amount : 0;
}
/**