orders()->sum('qty'); } public function getPriceAttribute($price) { return Money::inDefaultCurrency($price); } public function orders() { return $this->belongsToMany(Order::class, 'flash_sale_product_orders', 'flash_sale_product_id') ->withPivot('qty'); } }