当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::findOrFail方法代码示例

本文整理汇总了PHP中Setting::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::findOrFail方法的具体用法?PHP Setting::findOrFail怎么用?PHP Setting::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::findOrFail方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 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');
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:27,代码来源:SettingsController.php

示例2: ajax_update_notification

 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);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:8,代码来源:NotificationSettingsController.php

示例3: update

 /**
  * 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");
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:16,代码来源:SettingsController.php

示例4: postIndex

 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'));
 }
开发者ID:mladjom,项目名称:smartinvoice,代码行数:13,代码来源:SettingsController.php

示例5: 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);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:20,代码来源:SettingsController.php

示例6: update

 /**
  * 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");
 }
开发者ID:jboz62,项目名称:cms,代码行数:46,代码来源:SettingsController.php

示例7: update

 /**
  * 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');
 }
开发者ID:waldenylson,项目名称:alfredapp,代码行数:16,代码来源:SettingsController.php

示例8: fetch

 /**
  * 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;
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:12,代码来源:Setting.php


注:本文中的Setting::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。