This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mobile\ConectaSusAb\Intranet;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Intranet\Municipio;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MunicipioController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
$municipios = $this->get(Municipio::class)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(function ($municipo) {
|
||||
|
||||
return [
|
||||
'id' => $municipo->id,
|
||||
'nome' => $municipo->nome,
|
||||
'ibge' => $municipo->ibge,
|
||||
'estado_id' => $municipo->estado->id,
|
||||
'estado_codigo' => $municipo->estado->codigo,
|
||||
'estado_nome' => $municipo->estado->nome,
|
||||
'estado_uf' => $municipo->estado->uf,
|
||||
];
|
||||
});
|
||||
|
||||
return response()->json($municipios, Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user