Beispiel #1
0
 public function update($id)
 {
     $setting = Setting::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     unset($data['logo']);
     // Logo Image Upload
     if (Input::hasFile('logo')) {
         $path = public_path() . "/assets/admin/layout/img/";
         File::makeDirectory($path, $mode = 0777, true, true);
         $image = Input::file('logo');
         $extension = $image->getClientOriginalExtension();
         $filename = "logo.{$extension}";
         $filename_big = "logo-big.{$extension}";
         Image::make($image->getRealPath())->save($path . $filename);
         Image::make($image->getRealPath())->save($path . $filename_big);
         $data['logo'] = $filename;
     }
     $currencyArray = explode(':', $data['currency']);
     $data['currency'] = $currencyArray[1];
     $data['currency_icon'] = $currencyArray[0];
     $setting->update($data);
     Session::flash('success', '<strong>Success! </strong>Updated Successfully');
     return Redirect::route('admin.settings.edit', 'setting');
 }
 public function ajax_update_notification()
 {
     $setting = Setting::findOrFail(Input::get('id'));
     $input[Input::get('type')] = Input::get('value');
     $setting->update($input);
     $output['success'] = 'success';
     return Response::json($output, 200);
 }
 /**
  * Update the specified setting in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $setting = Setting::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $setting->update($data);
     return Redirect::route('admin.settings.index')->withTitle('Settings')->with("successMessage", "Pengaturan Berhasil diubah");
 }
 public function postIndex()
 {
     //dd(Input::all());
     $user = Auth::user()->id;
     $setting = Setting::findOrFail(Input::get('id'));
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $settings = array('language' => Input::get('language'), 'currency_id' => Input::get('country_id'));
     $item = Setting::where('id', '=', Input::get('id'))->update($settings);
     return Redirect::to('settings')->with('success', Lang::get('settings.message.success.update'));
 }
 /**
  * Update the specified setting in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id)
 {
     $id = Input::get('id');
     $setting = Setting::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::has('modeSetting')) {
         $setting->update($data);
     }
     $message = "更新しました。";
     return Redirect::route('settings.index')->with('message', $message);
 }
Beispiel #6
0
 /**
  * Update the specified resource in storage.
  * PUT /settings/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $validator = Validator::make($data = Input::all(), ['color' => 'required']);
     $setting = Setting::findOrFail($id);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::get('remove_logo') != NULL) {
         $data['logo'] = '';
     } elseif (Input::hasFile('logo')) {
         $file = Input::file('logo');
         $filename = $file->getClientOriginalName();
         $destination = $this->settings_path;
         if (!$this->filesystem->exists($destination)) {
             $this->filesystem->mkdir($destination);
         }
         try {
             Input::file('logo')->move($destination, $filename);
         } catch (Exception $e) {
             dd("Error uploading file " . $e->getMessage());
         }
         $data['logo'] = $filename;
     } else {
         $data['logo'] = $setting->logo;
     }
     $setting->color = $data['color'];
     $setting->logo = $data['logo'];
     $setting->name = $data['name'];
     $setting->maintenance_mode = isset($data['maintenance_mode']) ? 1 : 0;
     $this->setRobot($setting->maintenance_mode);
     $setting->facebook = isset($data['facebook']) ? $data['facebook'] : '';
     $setting->linkedin = isset($data['linkedin']) ? $data['linkedin'] : '';
     $setting->twitter = isset($data['twitter']) ? $data['twitter'] : '';
     $setting->pinterest = isset($data['pinterest']) ? $data['pinterest'] : '';
     $setting->gplus = isset($data['gplus']) ? $data['gplus'] : '';
     $setting->footer = isset($data['footer']) ? $data['footer'] : '';
     $setting->save();
     return Redirect::to("/settings/" . $setting->id . "/edit")->withMessage("Settings Updated");
 }
 /**
  * Update the specified setting in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $setting = Setting::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $setting->update($data);
     return Redirect::route('settings.index');
 }
Beispiel #8
0
 /**
  * fetch() Fetch and return a current database value
  * @var string, Setting name to fetch the value of
  *
  * @return string, The current setting value
  * */
 public static function fetch($name)
 {
     $setting = Setting::findOrFail($name);
     $value = $setting->value;
     return $value;
 }