/** * @param BillFormRequest $request * @param BillRepositoryInterface $repository * * @return \Illuminate\Http\RedirectResponse */ public function store(BillFormRequest $request, BillRepositoryInterface $repository) { $billData = $request->getBillData(); $bill = $repository->store($billData); Session::flash('success', 'Bill "' . e($bill->name) . '" stored.'); Preferences::mark(); if (intval(Input::get('create_another')) === 1) { // set value so create routine will not overwrite URL: Session::put('bills.create.fromStore', true); return redirect(route('bills.create'))->withInput(); } // redirect to previous URL. return redirect(Session::get('bills.create.url')); }