diff --git a/app/Models/Pedido.php b/app/Models/Pedido.php index 31bd7be..ae55e70 100644 --- a/app/Models/Pedido.php +++ b/app/Models/Pedido.php @@ -29,6 +29,6 @@ public function barrio(): BelongsTo */ public function productos(): BelongsToMany { - return $this->belongsToMany(Producto::class); + return $this->belongsToMany(Producto::class)->withPivot(['cantidad','total']); } } diff --git a/app/Models/Producto.php b/app/Models/Producto.php index 92593de..07299c3 100644 --- a/app/Models/Producto.php +++ b/app/Models/Producto.php @@ -29,7 +29,7 @@ public function categoria(): BelongsTo */ public function pedidos(): BelongsToMany { - return $this->belongsToMany(Pedido::class); + return $this->belongsToMany(Pedido::class)->withPivot(['cantidad','total']); } /**