pivot en relacion
This commit is contained in:
parent
9155f974b6
commit
382b973227
2 changed files with 2 additions and 2 deletions
|
@ -29,6 +29,6 @@ class Pedido extends Model
|
||||||
*/
|
*/
|
||||||
public function productos(): BelongsToMany
|
public function productos(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Producto::class);
|
return $this->belongsToMany(Producto::class)->withPivot(['cantidad','total']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Producto extends Model
|
||||||
*/
|
*/
|
||||||
public function pedidos(): BelongsToMany
|
public function pedidos(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Pedido::class);
|
return $this->belongsToMany(Pedido::class)->withPivot(['cantidad','total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue