0
A piece of my application, consists of the client logging in and from there registering some relevant information daily. When logging in, it drops to the screen to choose which capture it will log the data into. Next time 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 to some capture, I’m always directed to the Capture System page belonging to capture 1. Regardless of the capture I choose, I’m always directed to the capture system 1. Using Laravel’s dd() method to debug, I realized that the parameter (int id) of my client methodCaptacao de Captacaocontroller has value 1.
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 from my Slide where I create the links above:
<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>