2021-12-30 11:49:40 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-01-05 14:11:07 -03:00
|
|
|
use App\GrupoDeCompra;
|
2022-01-05 18:14:21 -03:00
|
|
|
use App\Producto;
|
2021-12-30 11:49:40 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| API Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register API routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| is assigned the "api" middleware group. Enjoy building your API!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-01-05 14:11:07 -03:00
|
|
|
Route::middleware('auth:api')->group(function () {
|
|
|
|
Route::get('/regiones', function() {
|
2022-01-05 16:06:28 -03:00
|
|
|
return GrupoDeCompra::all()->pluck('region')->unique()->flatten();
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::prefix('grupos-de-compra')->group( function(){
|
|
|
|
Route::get('/', function() {
|
|
|
|
$atributos_a_ocultar = ['id', 'telefono', 'cantidad_de_nucleos', 'correo', 'referente_finanzas', 'created_at', 'updated_at'];
|
|
|
|
return GrupoDeCompra::all()->makeHidden($atributos_a_ocultar)->sortBy('nombre')->groupBy('region');
|
|
|
|
});
|
2022-01-05 14:11:07 -03:00
|
|
|
});
|
2022-01-05 18:14:21 -03:00
|
|
|
|
|
|
|
Route::get('/categorias', function() {
|
|
|
|
return Producto::all()->pluck('categoria')->unique()->flatten();
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::prefix('productos')->group(function () {
|
|
|
|
Route::get('/','Api\ProductoController@index');
|
|
|
|
});
|
2021-12-30 11:49:40 -03:00
|
|
|
});
|