Adaptados metodos faltantes() y sobrantes() para crear el pedido correspondiente
This commit is contained in:
parent
3366de8c31
commit
a44c074593
1 changed files with 14 additions and 2 deletions
|
@ -18,12 +18,24 @@ class GrupoDeCompra extends Model
|
||||||
|
|
||||||
public function faltantes()
|
public function faltantes()
|
||||||
{
|
{
|
||||||
return 'Faltantes de ' . $this->nombre;
|
return Subpedido::firstOrCreate([
|
||||||
|
'nombre' => 'Faltantes de ' . $this->nombre,
|
||||||
|
'grupo_de_compra_id' => $this->id
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'es_faltantes' => true
|
||||||
|
])->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sobrantes()
|
public function sobrantes()
|
||||||
{
|
{
|
||||||
return 'Sobrantes de ' . $this->nombre;
|
return Subpedido::firstOrCreate([
|
||||||
|
'nombre' => 'Sobrantes de ' . $this->nombre,
|
||||||
|
'grupo_de_compra_id' => $this->id
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'es_sobrantes' => true
|
||||||
|
])->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toggleDevoluciones()
|
public function toggleDevoluciones()
|
||||||
|
|
Loading…
Add table
Reference in a new issue