33 lines
893 B
PHP
33 lines
893 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Mobile\ConectaSusAb\Cadastro;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Cadastro\SujeitoAtencao\Alergia;
|
|
use Illuminate\Http\Response;
|
|
|
|
class AlergiaController extends Controller
|
|
{
|
|
protected $modulo = 'cadastro';
|
|
protected $funcionalidade = 'alergia';
|
|
|
|
public function index()
|
|
{
|
|
|
|
$alergias = Alergia::with(['tipo'])
|
|
->orderBy('agente_substancia_especifica')
|
|
->get()
|
|
->map(function ($alergia) {
|
|
|
|
return [
|
|
'id' => $alergia->id,
|
|
'agente_substancia_especifica' => $alergia->agente_substancia_especifica,
|
|
'tipo_id' => $alergia->tipo->id,
|
|
'tipo_descricao' => $alergia->tipo->descricao,
|
|
];
|
|
});
|
|
|
|
return response()->json($alergias, Response::HTTP_OK);
|
|
}
|
|
}
|