mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Some code cleanup and fixes.
This commit is contained in:
@@ -82,19 +82,20 @@ class PiggybankController extends BaseController
|
||||
public function store()
|
||||
{
|
||||
$piggyBank = $this->_repository->store(Input::all());
|
||||
if (!$piggyBank->id) {
|
||||
Session::flash('error', 'Could not save piggy bank: ' . $piggyBank->errors()->first());
|
||||
|
||||
return Redirect::route('piggybanks.create')->withInput();
|
||||
} else {
|
||||
if ($piggyBank->validate()) {
|
||||
Session::flash('success', 'New piggy bank "' . $piggyBank->name . '" created!');
|
||||
|
||||
|
||||
if (Input::get('create') == '1') {
|
||||
return Redirect::route('piggybanks.create')->withInput();
|
||||
}
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
|
||||
|
||||
} else {
|
||||
Session::flash('error', 'Could not save piggy bank: ' . $piggyBank->errors()->first());
|
||||
|
||||
return Redirect::route('piggybanks.create')->withInput();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,9 +104,17 @@ class PiggybankController extends BaseController
|
||||
{
|
||||
|
||||
$piggyBank = $this->_repository->update(Input::all());
|
||||
Session::flash('success', 'Piggy bank "' . $piggyBank->name . '" updated.');
|
||||
if ($piggyBank->validate()) {
|
||||
Session::flash('success', 'Piggy bank "' . $piggyBank->name . '" updated.');
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
} else {
|
||||
Session::flash('error', 'Could not update piggy bank: ' . $piggyBank->errors()->first());
|
||||
|
||||
return Redirect::route('piggybanks.edit', $piggyBank->id)->withErrors($piggyBank->errors())->withInput();
|
||||
}
|
||||
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
}
|
||||
|
||||
public function updateAmount(Piggybank $piggybank)
|
||||
|
||||
Reference in New Issue
Block a user