New setting called 'budgetMaximum', see issue #36

This commit is contained in:
James Cole 2014-12-23 21:13:59 +01:00
parent cdb5875d6b
commit cb2b44fef3

View File

@ -33,9 +33,12 @@ class PreferencesController extends BaseController
$viewRange = $preferences->get('viewRange', '1M');
$viewRangeValue = $viewRange->data;
$frontPage = $preferences->get('frontpageAccounts', []);
$budgetMax = $preferences->get('budgetMaximum', 1000);
$budgetMaximum = $budgetMax->data;
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontPage)->with('viewRange', $viewRangeValue);
return View::make('preferences.index', compact('budgetMaximum'))->with('accounts', $accounts)->with('frontpageAccounts', $frontPage)->with(
'viewRange', $viewRangeValue
);
}
/**
@ -43,7 +46,6 @@ class PreferencesController extends BaseController
*/
public function postIndex()
{
/** @var \FireflyIII\Shared\Preferences\Preferences $preferences */
$preferences = App::make('FireflyIII\Shared\Preferences\Preferences');
@ -61,6 +63,11 @@ class PreferencesController extends BaseController
Session::forget('end');
Session::forget('range');
// budget maximum:
$budgetMaximum = intval(Input::get('budgetMaximum'));
$preferences->set('budgetMaximum', $budgetMaximum);
Session::flash('success', 'Preferences saved!');
return Redirect::route('preferences');