My url now has the value I need which is /search/{$nombor}
. How do I call this variable in the next page?
For example, the url is /search/3
and I want to print 3 in the next page.
Here is my code
web.php
route::get('/search',[searchController::class, 'search'])->name('web.search');
route::get('/search/{nombor}',[searchController::class, 'daftar'])->name('web.daftar');
searchController.php
class searchController extends Controller
{
function daftar($nombor){
return view('dahDaftar', compact ('nombor'));
}
}
search.blade.php
<td>
<a href="search/{{ $nama->nombor }}">DAFTAR</a>
</td>
dahDaftar.blade.php
<body>
<hr>*PRINT HERE*</hr>
</body>
Thank you
CodePudding user response:
You print it out using the same method you've used for the {{ $nama->nombor }}
, so:
{{ $nombor }}