我在Laravel 5這樣的URL:如何將用戶重定向到自定義URL(視圖)?
domain.com/search-user/[email protected]
當我進入這個URL,它會自動給出電子郵件搜索數據。
我應該如何將用戶從其他控制器重定向到此URL?
我都試過了,但它不工作:
return view(‘controller.search-user')->with('email', $request->email);
我的路線文件:
Route::post('/search-user', '[email protected]');
Route::get('/search-user/{email}', '[email protected]');
-------解決--------- - 解決問題,只能用這個代碼(也許它不是最好的做法,但其他解決方案沒有工作):
return \Redirect::to('http://domain.com/search-user/'.$request->email);
謝謝,但我得到這樣的錯誤:「InvalidArgumentException在UrlGenerator.php行314:路由[搜索用戶]未定義。」我還在主題中包含了路線文件信息。 –