WIP: funcion/faltantes-y-sobrantes #40

Closed
atasistro wants to merge 4 commits from funcion/faltantes-y-sobrantes into master
Showing only changes of commit a44c074593 - Show all commits

View file

@ -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()