Esempio n. 1
0
 public function postSave()
 {
     $settings = Input::get('set');
     if (is_array($settings)) {
         foreach ($settings as $key => $set) {
             $sett = SettingsModel::find($key);
             if (!$sett) {
                 $sett = new SettingsModel();
                 $sett->key = $key;
             }
             $sett->value = $set;
             $sett->save();
         }
     }
     $jsn = @json_encode($settings);
     Log::info('Edit settings ' . $jsn);
     return [];
 }
Esempio n. 2
0
 /**
  *  Редактирование
  */
 public function anyEdit()
 {
     //die;
     $id = (int) $this->getRequestParam('id') ?: null;
     $item = \SettingsModel::find($id);
     if (null !== Arr::get($this->getPostData(), 'submit')) {
         $data = Arr::get($this->getPostData(), 'value');
         $item->value = $data;
         try {
             //изменения елемента по id
             $item->save();
             Event::fire('Admin.settingsUpdate');
         } catch (QueryException $e) {
             //                Message::instance()->warning('Setting was don\'t edited');
             //echo '<pre>';
             //print_r($e->getMessage());die;
         }
     }
     $this->layout->content = View::make('back/setting/edit')->with('id', $id)->with('item', $item);
 }