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


PHP Setting::save方法代码示例

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


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

示例1: patchSettings

 /**
  * Update the settings in storage.
  *
  * @param Setting $setting
  * @param SettingRequest $request
  * @return Response
  */
 public function patchSettings(Setting $setting, SettingRequest $request)
 {
     $data = $this->storeImage($request, 'logo');
     $setting->fill($data);
     $setting->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.setting.index'));
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:14,代码来源:SettingController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $setting = new Setting();
     $setting->serty_id = $request->serty_id;
     $setting->sett_hour = $request->hour;
     $setting->save();
     return Redirect::to('setting');
 }
开发者ID:lamadipen,项目名称:tracker,代码行数:14,代码来源:SettingController.php

示例3: saveSettings

 public function saveSettings(Request $request)
 {
     $input = $request->all();
     $notification = Setting::where('name', 'notification')->first();
     if (!count($notification)) {
         $notification = new Setting();
         $notification->name = 'notification';
     }
     $notification->value = $input['notification'];
     $notification->save();
     return redirect()->route('admin');
 }
开发者ID:andremiguelaa,项目名称:liga-quiz,代码行数:12,代码来源:AdminController.php

示例4: addSetting

 public static function addSetting($setting, $value)
 {
     $settingobj = Setting::where('name', '=', $setting)->first();
     if ($settingobj) {
         return;
     }
     $settingobj = new Setting();
     if ($setting) {
         $settingobj->name = $setting;
         $settingobj->value = $value;
         $settingobj->save();
     }
 }
开发者ID:sordev,项目名称:bootup,代码行数:13,代码来源:Setting.php

示例5: index

 public function index()
 {
     if (Request::isMethod('get')) {
         $lang = Language::all();
         $settings = Setting::all();
         return view('admin.settings.index', array('langs' => $lang, 'settings' => $settings));
     }
     /// POST
     $data = Request::all();
     $s = new Setting();
     $s->name = $data['name'];
     $s->lang_code = $data['lang_code'];
     $s->value = $data['value'];
     $s->type = 'var';
     $s->save();
     return redirect('admin/settings');
 }
开发者ID:namcoder,项目名称:Topshare,代码行数:17,代码来源:SettingsController.php

示例6: update

 public function update(Request $request, Setting $setting)
 {
     $insert = $setting->fill($request->input())->save();
     $image = \Input::get('image');
     if ($image != '') {
         $imagename = 'setting-' . rand(11111, 99999) . '-gudperna.png';
         $image = str_replace(' ', '+', $image);
         list($type, $image) = explode(';', $image);
         list(, $image) = explode(',', $image);
         $image = base64_decode($image);
         file_put_contents('upload/img/' . $imagename, $image);
         $setting->image = $imagename;
         $setting->save();
     }
     if ($insert) {
         return 0;
     } else {
         return 1;
     }
 }
开发者ID:gugundwipermana,项目名称:laravel-serviceac,代码行数:20,代码来源:SettingsController.php

示例7: create

 public function create()
 {
     // check if it's our form
     if (Session::token() !== Input::get('_token')) {
         return response()->json(array('msg' => 'Unauthorized attempt to create Setting'));
     }
     // retrieve the data
     $setting_name = Input::get('setting_name');
     $setting_value = Input::get('setting_value');
     //..................
     //validate data and store in db here...
     $setting = new Setting();
     $setting->setting_name = $setting_name;
     $setting->setting_value = $setting_value;
     $setting->save();
     //..................
     // create a response message and send it.
     $response = array('status' => 'success', 'msg' => 'setting created successfully');
     return response()->json($response);
 }
开发者ID:ebrimamaubeh,项目名称:utg_bantaba,代码行数:20,代码来源:SettingsController.php

示例8: upload

 public function upload()
 {
     // getting all of the post data
     $file = array('image' => Input::file('image'));
     // setting up rules
     $rules = array('image' => 'required');
     //mimes:jpeg,bmp,png and for max size max:10000
     // doing the validation, passing post data, rules and the messages
     $validator = Validator::make($file, $rules);
     Cache::flush();
     if ($validator->fails()) {
         // send back to the page with the input data and errors
         return Redirect::to('logo')->withInput()->withErrors($validator);
     } else {
         // checking file is valid.
         if (Input::file('image')->isValid()) {
             $destinationPath = 'uploads';
             // upload path
             $extension = Input::file('image')->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(11111, 99999) . '.' . $extension;
             // renameing image
             Input::file('image')->move($destinationPath, $fileName);
             // uploading file to given path// sending back with message
             //store into db
             $logoUrl = Setting::where('meta_name', 'logo_url')->first();
             if (empty($logoUrl)) {
                 $logoUrl = new Setting();
             }
             $logoUrl->meta_name = 'logoUrl';
             $logoUrl->meta_value = $destinationPath . '/' . $fileName;
             $logoUrl->save();
             return redirect()->route('logo')->with('message', 'Logo updated.')->with('message-class', 'success');
         } else {
             // sending back with error message.
             Session::flash('error', 'uploaded file is not valid');
             return redirect()->route('logo')->with('message', 'Uploaded file is not valid.')->with('message-class', 'error');
         }
     }
 }
开发者ID:HeidiWang123,项目名称:our-world-in-data-grapher,代码行数:40,代码来源:LogoController.php

示例9: update

 public function update(Request $request)
 {
     $langs = get_langs();
     foreach ($langs as $lang) {
         $datas = $request->input($lang->code);
         foreach ($datas as $key => $value) {
             $value = is_array($value) ? serialize($value) : $value;
             $args = ['lang_id' => $lang->id, 'key' => $key, 'value' => $value];
             $cond = Setting::where('key', $key)->where('lang_id', $lang->id);
             if ($cond->count() > 0) {
                 $cond->update(['value' => $value]);
             } else {
                 $meta = new Setting();
                 $meta->lang_id = $lang->id;
                 $meta->key = $key;
                 $meta->value = $value;
                 $meta->save();
             }
         }
     }
     return redirect()->back()->with('Mess', 'Cập nhật thành công');
 }
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:22,代码来源:SettingController.php

示例10: store

 public function store(Request $request)
 {
     $this->validate($request, ['app_name' => 'required|max:100']);
     \DB::beginTransaction();
     try {
         $settings = Setting::find(1);
         if (!empty($settings)) {
             $settings->app_name = $request->app_name;
             $settings->update();
         } else {
             $settings = new Setting();
             $settings->app_name = $request->app_name;
             $settings->save();
         }
         \DB::commit();
         Session::flash('flash_message', 'Settings successfully updated!');
         return redirect()->back();
     } catch (Exception $e) {
         DB::rollBack();
         return redirect()->back();
     }
 }
开发者ID:renciebautista,项目名称:sparepartsfinder,代码行数:22,代码来源:SettingsController.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('settings')->truncate();
     $setting = new Setting();
     $setting->name = "adult_rate_day";
     $setting->value = 175;
     $setting->save();
     $setting = new Setting();
     $setting->name = "adult_rate_night";
     $setting->value = 195;
     $setting->save();
     $setting = new Setting();
     $setting->name = "kids_rate_day";
     $setting->value = 135;
     $setting->save();
     $setting = new Setting();
     $setting->name = "kids_rate_night";
     $setting->value = 155;
     $setting->save();
     $setting = new Setting();
     $setting->name = "toddlers";
     $setting->value = 100;
     $setting->save();
 }
开发者ID:jmramos02,项目名称:altaroca,代码行数:29,代码来源:SettingTableSeeder.php

示例12: set

 /**
  * Set
  * @param $key
  * @param $value
  *
  * @return Setting|void
  */
 public function set($key, $value)
 {
     if ($this->get('installed') && !Auth::user()->isAdmin) {
         abort(403);
     }
     if (in_array($key, $this->envSettings)) {
         return $this->writeToEnvFile($key, $value);
     }
     $setting = Setting::where('name', $key)->first();
     if (!$setting) {
         $setting = new Setting(['name' => $key]);
     }
     $setting->value = $value;
     $setting->save();
     return $setting;
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:23,代码来源:Settings.php

示例13: settingsSave

 public function settingsSave(Request $request)
 {
     $s = Setting::first();
     if (!$s) {
         $s = new Setting();
     }
     $s->fill($request->all());
     $s->save();
     return redirect('/dashboard/settings');
 }
开发者ID:ElliottLandsborough,项目名称:lararel-simple-library,代码行数:10,代码来源:AdminController.php

示例14: patchSettings

 /**
  * Update the settings in storage.
  *
  * @param Setting $setting
  * @param SettingRequest $request
  * @return Response
  */
 public function patchSettings(Setting $setting, SettingRequest $request)
 {
     $setting->fill(ImageService::uploadImage($request, 'logo'));
     $setting->save() ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.setting.index'));
 }
开发者ID:amanullah-1,项目名称:laravel-5-simple-cms,代码行数:13,代码来源:SettingController.php


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