From da93fb18b8d0fa002de8db302b4a461244a8e74e Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 22 Nov 2013 03:16:58 -0500 Subject: [PATCH] Added settings controller --- app/controllers/admin/SettingsController.php | 89 ++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 app/controllers/admin/SettingsController.php diff --git a/app/controllers/admin/SettingsController.php b/app/controllers/admin/SettingsController.php new file mode 100644 index 0000000000..fe355729ae --- /dev/null +++ b/app/controllers/admin/SettingsController.php @@ -0,0 +1,89 @@ +paginate(10); + + // Show the page + return View::make('backend/settings/index', compact('settings')); + } + + + /** + * Setting update. + * + * @param int $settingId + * @return View + */ + public function getEdit() + { + $settings = Setting::orderBy('created_at', 'DESC')->paginate(10); + return View::make('backend/settings/edit', compact('settings')); + } + + + /** + * Setting update form processing page. + * + * @param int $settingId + * @return Redirect + */ + public function postEdit() + { + + $new = Input::all(); + + // create a new model instance + $setting = new Location(); + + // attempt validation + if ($setting->validate($new)) + { + + // Update the setting data + $setting->option_value = e(Input::get('name')); + + + // Was the asset created? + if($setting->save()) + { + // Redirect to the saved setting page + return Redirect::to("admin/settings/app/$settingId/edit")->with('success', Lang::get('admin/settings/message.update.success')); + } + } + else + { + // failure + $errors = $setting->errors(); + return Redirect::back()->withInput()->withErrors($errors); + } + + // Redirect to the setting management page + return Redirect::to("admin/settings/app/$settingId/edit")->with('error', Lang::get('admin/settings/message.update.error')); + + } + + + + +}