_accounts = $accounts; $this->_preferences = $preferences; } /** * @return $this|\Illuminate\View\View */ public function index() { $accounts = $this->_accounts->getDefault(); $viewRange = $this->_preferences->get('viewRange', '1M'); $viewRangeValue = $viewRange->data; // pref: $frontpage = $this->_preferences->get('frontpageAccounts', []); return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage) ->with('viewRange', $viewRangeValue); } /** * @return \Illuminate\Http\RedirectResponse */ public function postIndex() { // frontpage accounts $frontpageAccounts = []; foreach (Input::get('frontpageAccounts') as $id) { $frontpageAccounts[] = intval($id); } $this->_preferences->set('frontpageAccounts', $frontpageAccounts); // view range: $this->_preferences->set('viewRange', Input::get('viewRange')); // forget session values: Session::forget('start'); Session::forget('end'); Session::forget('range'); Session::flash('success', 'Preferences saved!'); return Redirect::route('preferences'); } }