Maybe I'm missing something but I can't figure out how to do this.
I have a index view that lists all the records from my tiers table. The page has a "Create New Tier" button that displays a form. The user enters the data for the new tier and hits the submit button. In my TierController I have the following:
public function store()
{
//
$data = Input::all();
$tier = new Tier();
$tier->name=$data['name'];
$tier->price = $data['price'];
$tier->save();
return Redirect::back()->with('message',"Tier created successfully.");
}
This takes me back to the empty create form and displays the message but the user has to press the back button to return to the index view which doesn't show the new data until I hit refresh. I would like to have the system automatically return to the index view after the submit button is clicked with the refreshed data.
I know that I can do a Redirect::to('tiers.index')->with('message','Tier created successfully') but the problem I have with that is then the browser history looks like
tier.index -> tier.create -> tier.index
This then is very confusing for the user when they do hit the back button as the create view shows up and freaks them out.
Is there a way to do a Redirect::back (or something) that would not leave the tier.create view in the history and also refresh the index data?
Thanks