A piece of my application consists of the client login and from there to register some pertinent information daily. When logging in, it falls on the screen to choose in which capture it will register the data. In the next one he chooses which capture system, and finally, he inserts the data. For this I have the following routes:
Route::get('/prop/{id_prop}/', 'PropriedadeController@clientePropriedade');
Route::get('/prop/{id_prop}/cap/{id_cap}/', 'CaptacaoController@clienteCaptacao')->name('cap');
Route::get('/prop/{id_prop}/cap/{id_cap}/sis/{id_sis}/', 'SistemaController@clienteSistema')->name('sis');
My problem is: when I click on the link for some capture, I'm always directed to the capture system page belonging to capture 1. Regardless of the capture that I choose, I'm always directed to the capture system 1. Using the method I am trying to find a way to do this, but I can not figure out how to do this.
public function clienteCaptacao(int $id)
{
dd($id);//valor 1
$cap = Captacao::find($id);
//dd($cap);
if (!isset($cap)) {
return view('erros.cliente.nCadastrado',
array('nome' => 'captações'));
} else {
return view('cliente.escolheSistema', compact('cap'));
}
}
The links are correct:
<div class="col-lg-3 col-md-6">
<a href=http://h20.laravel/cliente/prop/1/cap/1
class="btn btn-secondary btn-block" style="background-color:red">Captacao 1</a>
</div>
<div class="col-lg-3 col-md-6">
<a href=http://h20.laravel/cliente/prop/1/cap/2
class="btn btn-secondary btn-block" style="background-color:red">Captacao 2</a>
</div>
<div class="col-lg-3 col-md-6">
<a href=http://h20.laravel/cliente/prop/1/cap/3
class="btn btn-secondary btn-block" style="background-color:red">Captacao 3</a>
</div>
These are the codes on my blade where I create the above links:
<div class="row">
@foreach ($prop->captacoes as $cap)
<div class="col-lg-3 col-md-6">
<a href={{
URL::route("cap",
['id_prop'=>$prop->id, 'id_cap'=>$cap->id])}}
class="btn btn-secondary btn-block" style="background-color:red">{{$cap->nome}}</a>
</div>
@endforeach
</div>