From 382b9732279d3cac7c3c5e470dc69514296ff344 Mon Sep 17 00:00:00 2001 From: ale Date: Fri, 15 Mar 2024 01:34:57 -0300 Subject: [PATCH] pivot en relacion --- app/Models/Pedido.php | 2 +- app/Models/Producto.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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']); } /**