diff --git a/app/GrupoDeCompra.php b/app/GrupoDeCompra.php index 09ec62b..2f9ad4e 100644 --- a/app/GrupoDeCompra.php +++ b/app/GrupoDeCompra.php @@ -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']; diff --git a/database/migrations/2023_11_12_145219_habilitar_devoluciones.php b/database/migrations/2023_11_12_145219_habilitar_devoluciones.php new file mode 100644 index 0000000..e94da1d --- /dev/null +++ b/database/migrations/2023_11_12_145219_habilitar_devoluciones.php @@ -0,0 +1,32 @@ +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'); + }); + } +} diff --git a/routes/api.php b/routes/api.php index b21e7bc..d1ebbe4 100644 --- a/routes/api.php +++ b/routes/api.php @@ -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 () {