php - Duplicate var on href Laravel 5.2 -


this route

route::get('ph/{id}/informe', function ($id) {   $ph = ph::find($id);   return view('ph.informe')->withphs($ph); }); 

when print name in title have no problem

<p>informe confidencial: {{ $phs->name }}</p> =====>  <p>informe confidencial: test1</p> 

but when try pass id href tag this

<a href='ph/{{ $phs->id }}/informe/etapas'> 

but output

http://localhost:8000/ph/10/ph/10/informe/etapas

why id prints /ph/10/ph/10/?

firstly should name route:

route::get('ph/{id}/informe', function ($id) {   $ph = ph::find($id);   return view('ph.informe')->withphs($ph); })->name('routename'); 

then should pass route name data want pass:

<a href="{{ route('routename', ['data' => $phs->id]) }}">your link</a> 

of course need adjust route name , data pass.

i think you.


Comments