Agregados fillable faltantes + productos no barriales en metodos para armar planillas
This commit is contained in:
parent
a006fc15fa
commit
85b3f1dd0f
1 changed files with 9 additions and 4 deletions
|
@ -14,13 +14,18 @@ use Illuminate\Support\Facades\DB;
|
|||
|
||||
class Producto extends Model
|
||||
{
|
||||
protected $fillable = ["nombre", "precio", "categoria"];
|
||||
protected $fillable = ["nombre", "precio", "categoria", "bono", "es_solidario", "requiere_notas"];
|
||||
|
||||
public function subpedidos(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Subpedido::class, 'productos_subpedidos')->withPivot(["cantidad", "notas"]);
|
||||
}
|
||||
|
||||
public static function noBarriales()
|
||||
{
|
||||
return self::where('nombre', 'not like', '%barrial%');
|
||||
}
|
||||
|
||||
// Este método permite que se apliquen los filtros al hacer una request (por ejemplo, de búsqueda)
|
||||
public function scopeFiltrar($query, FiltroDeProducto $filtros): Builder
|
||||
{
|
||||
|
@ -34,17 +39,17 @@ class Producto extends Model
|
|||
|
||||
public static function productosFilaID()
|
||||
{
|
||||
return Producto::pluck('id', 'fila')->all();
|
||||
return self::noBarriales()->pluck('id', 'fila')->all();
|
||||
}
|
||||
|
||||
public static function productosIDFila()
|
||||
{
|
||||
return Producto::pluck('fila', 'id')->all();
|
||||
return self::noBarriales()->pluck('fila', 'id')->all();
|
||||
}
|
||||
|
||||
public static function productosIDNombre()
|
||||
{
|
||||
return Producto::pluck('nombre', 'id')->all();
|
||||
return self::noBarriales()->pluck('nombre', 'id')->all();
|
||||
}
|
||||
|
||||
static public function cantidadesPorBarrio(): Collection
|
||||
|
|
Loading…
Add table
Reference in a new issue