I have a problem where I want to pass a parameter in the url, in this case "id". But when I click on the url it returns a 404 error. The route exists and this
is the code.
Web.php
Route::get('/chat/{id}', [AppHttpControllersAppController::class, 'chat'])->name('chat');
home.blade.php
<a href="/chat/{{$chat['id']}}">test</a>
AppController
return view('chat')
I did not put anything in the controller yet as i first wanted to test if it even links to the blade file.
I tried clearing the cache of the routes and renaming anything but still no positive result.
2
Answers
In your blade from where you are accessing the route change the code into this…
It should work like this. Even after that it won’t work run:
It will clear the route cache