Have you tried:
<a href="edit/{{ $user->id }}">Edit</a>
Try with and without leading slash.
What controller is this going to. And how are you passing the parameter in the route.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This has me losing my mind and I'm so annoyed. I've been looking for a solution to this simple thing for about 2 hours now.. I finally gave up! Why the hell am I getting a 404 not found on the edit page? There is nothing special to this application. It's the stock install I started yesterday to play around with roles and relationships.
My routes
Route::resource('/', App\Http\Controllers\WelcomeController::class);
welcome.blade.php
<a href="{{ $user->id }}/edit">Edit</a>
The controller
public function edit($id)
{
$user = User::findOrFail($id)
return view('edit', compact('user'));
}
I even tried to use dd in the edit method above and that didn't even work.
Here's the route list.. The create route works fine and I am able to insert into the db, but I am not sure why the URI is missing on the show, update, store, destroy and edit routes I never had this problem before.. I think that is the problem but don't know what to do.
GET|HEAD / index App\Http\Controllers\WelcomeController@index web
POST / store App\Http\Controllers\WelcomeController@store web
GET|HEAD api/user Closure api
App\Http\Middleware\Authenticate:sanctum
GET|HEAD create create App\Http\Controllers\WelcomeController@create web
GET|HEAD sanctum/csrf-cookie Laravel\Sanctum\Http\Controllers\CsrfCookieController@show web
GET|HEAD {} show App\Http\Controllers\WelcomeController@show web
PUT|PATCH {} update App\Http\Controllers\WelcomeController@update web
DELETE {} destroy App\Http\Controllers\WelcomeController@destroy web
GET|HEAD {}/edit edit App\Http\Controllers\WelcomeController@edit web
@dmcglone27 Resource routes are created under the assumption you're giving it a common prefix to use for the resource actions, routes and names.
// Notice the braces below.. this should contain a common URI that is generated by the resource name
GET|HEAD {}/edit edit App\Http\Controllers\WelcomeController@edit web
This should work:
Route::resource('welcome', App\Http\Controllers\WelcomeController::class);
<a href="/welcome/{{ $user->id }}/edit">Edit</a>
or just adding the route directly:
Route::get('/{user}/id', [App\Http\Controllers\WelcomeController::class, 'edit']);
Please or to participate in this conversation.