I want to keep the same url across 3 pages that have POST forms. When a form fails validation i'm doing \Redirect::back()->withErrors()
but if i'm on the second page it's returning to the 1st page. How can I return to the 2nd page instead of the 1st?
My routes are:
Route::post("/test",['as'=>'test','uses'=>'TestController@post']);
Route::get("/test",function(){ return View::make("pages.test"); });
My controller is:
class TestController extends Controller
{
function post(Request $request){
if($request->has("test1")){
return view('/pages/test2');
}elseif($request->has("test2")){
return \Redirect::back()->withErrors(["my error"]);
}else{
return "unknown test";
}
}
}
My blade files are test.blade.php:
Test1
test2.blade.php :
test2
When return \Redirect::back()->withErrors(["my error"]);
executes i'm expecting to return to test2.blade.php but i'm returning to test.blade.php. How can I fix this?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Gmj4CQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire