mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Moved some of the events so they will properly fire. Noticed the budget controllers are a bit of a mess. Next project.
This commit is contained in:
parent
9db8f78cd8
commit
5ac790433b
@ -86,6 +86,8 @@ class BudgetController extends BaseController
|
||||
$budgets = $this->_repository->get();
|
||||
$today = new Carbon;
|
||||
|
||||
Event::fire('budgets.change');
|
||||
|
||||
return View::make('budgets.indexByBudget')->with('budgets', $budgets)->with('today', $today);
|
||||
|
||||
}
|
||||
@ -100,6 +102,8 @@ class BudgetController extends BaseController
|
||||
$set = $this->_repository->get();
|
||||
$budgets = $this->_budgets->organizeByDate($set);
|
||||
|
||||
Event::fire('budgets.change');
|
||||
|
||||
return View::make('budgets.indexByDate')->with('budgets', $budgets);
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ class LimitController extends BaseController
|
||||
];
|
||||
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
Event::fire('budgets.change');
|
||||
|
||||
return View::make('limits.create')->with('budgets', $budgets)->with(
|
||||
'periods', $periods
|
||||
@ -67,6 +68,7 @@ class LimitController extends BaseController
|
||||
} else {
|
||||
Session::flash('error', 'Could not delete the envelope. Check the logs to be sure.');
|
||||
}
|
||||
Event::fire('budgets.change');
|
||||
if (Input::get('from') == 'date') {
|
||||
return Redirect::route('budgets.index');
|
||||
} else {
|
||||
@ -101,13 +103,14 @@ class LimitController extends BaseController
|
||||
$limit = $this->_limits->store(Input::all());
|
||||
if ($limit->validate()) {
|
||||
Session::flash('success', 'Envelope created!');
|
||||
Event::fire('budgets.change');
|
||||
if (Input::get('from') == 'date') {
|
||||
return Redirect::route('budgets.index');
|
||||
} else {
|
||||
return Redirect::route('budgets.index.budget');
|
||||
}
|
||||
} else {
|
||||
Session::flash('success', 'Could not save new envelope.');
|
||||
Session::flash('error', 'Could not save new envelope.');
|
||||
$budgetId = $budget ? $budget->id : null;
|
||||
$parameters = [$budgetId, 'from' => Input::get('from')];
|
||||
|
||||
@ -129,6 +132,7 @@ class LimitController extends BaseController
|
||||
$limit->repeat_freq = Input::get('period');
|
||||
$limit->repeats = !is_null(Input::get('repeats')) && Input::get('repeats') == '1' ? 1 : 0;
|
||||
$limit->amount = floatval(Input::get('amount'));
|
||||
Event::fire('budgets.change');
|
||||
if ($limit->save()) {
|
||||
Session::flash('success', 'Limit saved!');
|
||||
foreach ($limit->limitrepetitions()->get() as $rep) {
|
||||
|
@ -28,6 +28,7 @@ class EloquentLimitTrigger
|
||||
public function updateLimitRepetitions()
|
||||
{
|
||||
if (!\Auth::check() || is_null(\Auth::user())) {
|
||||
\Log::debug('No user for updateLimitRepetitions.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user