if($res){
return back()->with('success','You have signed in successful');
//this code is not working//
return redirect()->route('welcome');
} else {
return back()->with('fail','something went wrong');
}
CodePudding user response:
You can´t have 2 return in same block, the second never will be called.
If want go to the next view u should delete the first return:
if($res){
return redirect()->route('welcome');
} else {
return back()->with('fail','something went wrong');
}
CodePudding user response:
Instead of:
if($res){
return back()->with('success','You have signed in successful');
//this code is not working//
return redirect()->route('welcome');
} else {
return back()->with('fail','something went wrong');
}
Write:
if($res){
return redirect(route('welcome'))->with('success','You have signed in successful');
} else {
return redirect()->back()->with('fail','something went wrong');
}
You cant use two returns after each other. So just send the success message with the return at once.