Ejemplo n.º 1
0
 /**
  * @param $key
  * @param null $default
  * @return null
  */
 function option($key, $default = null)
 {
     try {
         $option = Option::findByKey($key)->first();
         return !empty($option) ? $option->value : $default;
     } catch (PDOException $e) {
         return $default;
     }
 }
Ejemplo n.º 2
0
 /**
  * Update the settings.
  *
  * @return mixed
  */
 public function updateSettings()
 {
     $settings = \Input::all();
     foreach ($settings as $key => $value) {
         $option = str_replace('_', '.', $key);
         Option::findByKey($option)->update(['value' => $value]);
     }
     return \Redirect::back()->withFlashMessage('Settings has been successfully updated!');
 }