📅  最后修改于: 2022-03-11 14:54:52.887000             🧑  作者: Mango
// using User->username instead of id on url:
public function show($user)
{
// where($param)->firstOrFail()
$user = User::whereUsername($user)->firstOrFail();
return view('users.show', ['user'=>$user]);
}