I've been trying to make a route for a while, but so far nothing ...
Controller:
public function profissionais(Request $request, $id){
$vinculo = session()->get('vinculo');
$profissionais = Vinculo::where('unidade_id', '=', $id)->get();
$unidades = Unidade::where('municipio_id', '=', $vinculo->usuario->municipio_id)
->get();
$profissionais = $id;
return view('relatorios.profissionais', compact('unidades', 'profissionais'));
}
Form:
<form method="GET" action="{{route('relatorios.profissionais', 'id')}}">
<select class="js-example-basic-single" name="id" required>
@foreach($unidades as $unidade)
<option value="{{$unidade->id}}">{{$unidade->descricao}}</option>
@endforeach
</select>
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Listar</button>
</span>
</form>
web.php:
Route::get('/relatorios/profissionais/{id}', 'RelatorioController@profissionais')->name('relatorios.profissionais');
I have tried it anyway, but I have not yet understood the logic in the system ...
I want the url to appear like this: /relatorios/profissionais/4
and the controller receives the number 4 in the $id
variable and look for the links.
But at the moment the url is being shown like this: relatorios/profissionais/id?id=4