This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mobile\ConectaSusAb\Sigtap;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
use App\Models\Sigtap\Competencia;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProcedimentoController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
$listaCamposProcedimentos = [
|
||||
'id',
|
||||
'competencia_id',
|
||||
'codigo',
|
||||
'nome',
|
||||
'complexidade',
|
||||
'sexo',
|
||||
'idade_minima',
|
||||
'idade_maxima'
|
||||
];
|
||||
|
||||
$ultimaCompetencia = Competencia::orderBy('valor', 'desc')->first(['id']);
|
||||
|
||||
$procedimentos = Procedimento::where('competencia_id', $ultimaCompetencia->id)
|
||||
->select($listaCamposProcedimentos)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return response()->json($procedimentos, Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user