我想将用户重定向到他们的个人资料,而不是laravel的默认/主页。我已经在我的LoginController中尝试了这一点:protected $ redirectTo ='/ profile/{id}';但它返回此错误:没有找到id:{id}的用户。登录后将用户重定向到他们的个人资料
这是我的路线:Route :: get('/ profile/{id}','ProfileController @ profile');
这是我的个人资料控制器方法:
public function profile(Request $request, $id){
$User = User::with(['complains'])->find($id);
if(!$User) return abort(404, 'User with id:'.$id.' not found');
return view('user.profile')->with(['user' => $User, 'complains' => $User-
>complains]);
}