belongsTo(User::class); } public function product(): BelongsTo { return $this->belongsTo(Product::class); } public function getSubtotalAttribute(): float { return (float) $this->product->price * $this->quantity; } }