This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user