I am trying to get a Laravel controller to return to a route after a create function is complete.
I have tried the following code in the screenshots, PLEASE HELP!!!
CodePudding user response:
return redirect()->route('Communities.Index')
CodePudding user response:
For redirection: return redirect()->route('Communities.Index');
For redirection to previous route: return redirect()->back();
For redirection with payload:
return redirect()->route('Communities.Index')->with('success', 'Item added to cart successfully!');
return redirect()->back()->with('error', 'This is an error message.');