agregado campo y ruta para togglear devoluciones

This commit is contained in:
Alejandro Tasistro 2023-11-12 20:13:17 -03:00
parent 10f4fefb0c
commit 4376586a23
3 changed files with 37 additions and 1 deletions

View File

@ -13,7 +13,7 @@ use League\Csv\Reader;
class GrupoDeCompra extends Model
{
public $timestamps = false;
protected $fillable = [ "nombre","region","telefono","correo","referente_finanzas","cantidad_de_nucleos","fila"];
protected $fillable = [ "nombre","region","telefono","correo","referente_finanzas","cantidad_de_nucleos","fila", "devoluciones_habilitadas"];
protected $table = 'grupos_de_compra';
protected $hidden = ['password'];

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class HabilitarDevoluciones extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('grupos_de_compra', function (Blueprint $table) {
$table->boolean('devoluciones_habilitadas')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('grupos_de_compra', function (Blueprint $table) {
$table->dropColumn('devoluciones_habilitadas');
});
}
}

View File

@ -36,6 +36,10 @@ Route::middleware('api')->group(function () {
$grupo = GrupoDeCompra::where('id',$gdc)->first();
return ['bonos_barriales' => $grupo->totalBonosBarriales()];
});
Route::get('/{gdc}/devoluciones-habilitadas', function($gdc) {
$habilitadas = GrupoDeCompra::where('id',$gdc)->value('devoluciones_habilitadas');
return ['devoluciones_habilitadas' => $habilitadas];
});
});
Route::prefix('subpedidos')->group(function () {