401 is not a NOT FOUND response status; it would suggest that the route is protected by the auth middleware and the request is by a guest.
Can't get route model binding to work
I've got a really simple question. I've got the following route:
Route::get('/users/{user}', 'UsersController@show');
It's the first in the list.
I've got the following function in UsersController:
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
class UsersController extends Controller
{
public function show(User $user)
{
return "hello world";
return view('profiles.show', [
'profileUser'=> $user,
'jobs'=> $user->jobs()->paginate(10)
]);
}
}
The User model is the usual one that comes with Auth.
This route always returns "sorry, the page you are looking for could not be found". Every time. The route, controller, and controller method are all identical to one in a similar route already in the app that works just fine.
Why isn't route model binding working in this particular instance? Is there some laravel wizardry that I'm not familiar with messing with this?
Have you done anything with the key for the User model, e.g. overriding the getRouteKeyName method on the User model?
Please or to participate in this conversation.