up
This commit is contained in:
+12
-12
@@ -64,18 +64,6 @@ class Confeccion extends Model
|
||||
}
|
||||
});
|
||||
|
||||
/* Recepciones polimórficas */
|
||||
public function recepciones()
|
||||
{
|
||||
return $this->morphMany(\App\Models\Recepcion::class, 'referencia');
|
||||
}
|
||||
|
||||
// Cuantas faltan por recibir
|
||||
public function getFaltantesAttribute()
|
||||
{
|
||||
return max(0, (int)($this->cantidad_enviada ?? 0) - (int)($this->cantidad_recibida ?? 0));
|
||||
}
|
||||
|
||||
// Mantener avance de OP cuando la confección se completa
|
||||
static::saved(function ($confeccion) {
|
||||
if ($confeccion->estado === 'completo') {
|
||||
@@ -83,4 +71,16 @@ class Confeccion extends Model
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Recepciones polimórficas */
|
||||
public function recepciones()
|
||||
{
|
||||
return $this->morphMany(\App\Models\Recepcion::class, 'referencia');
|
||||
}
|
||||
|
||||
// Cuantas faltan por recibir
|
||||
public function getFaltantesAttribute()
|
||||
{
|
||||
return max(0, (int)($this->cantidad_enviada ?? 0) - (int)($this->cantidad_recibida ?? 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user