pedi2/routes/api.php

30 lines
1007 B
PHP
Raw Normal View History

2021-12-30 11:49:40 -03:00
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\GrupoDeCompra;
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!
|
*/
Route::middleware('auth:api')->group(function () {
Route::get('/regiones', function() {
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');
});
});
2021-12-30 11:49:40 -03:00
});