*/ use HasFactory, SoftDeletes; protected $fillable = [ 'order_id', 'sku', 'product_name', 'color', ]; public function totalQuantity(): int { return array_sum($this->productSizes()->pluck('amount')->toArray()); } /** * @return BelongsTo */ public function order(): BelongsTo { return $this->belongsTo(Order::class); } /** * @return HasOne */ // public function serviceFile(): HasOne // { // return $this->hasOne(ServiceFile::class); // } /** * @return HasMany */ public function productSizes(): HasMany { return $this->hasMany(ProductSize::class); } }