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


PHP Setting::save方法代码示例

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


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

示例1: save

 public function save()
 {
     if (!$this->setting->getIsNewRecord()) {
         $this->setting->svalue = Json::encode($this->getAttributes());
     } else {
         $this->setting->skey = $this->getSettingKey();
         $this->setting->svalue = Json::encode($this->getAttributes());
     }
     return $this->setting->save();
 }
开发者ID:rusli-nasir,项目名称:yii2-php-ci,代码行数:10,代码来源:PhpLoc.php

示例2: saveSubject

 public function saveSubject(Request $request, Subject $subject, Setting $setting)
 {
     $title = $request->input('title');
     $subject->title = $title;
     $subject->save();
     $subject_id = $subject->id;
     session(array('subject_id' => $subject_id));
     $sheet_number = $request->input('sheet_number');
     $name_cell = $request->input('name_cell');
     $grade_cell = $request->input('grade_cell');
     $cell_range = $request->input('cell_range');
     $header_row = $request->input('header_row');
     $start_row = $request->input('start_row');
     $end_row = $request->input('end_row');
     $setting->subject_id = $subject_id;
     $setting->lec_xlsx = session('uploads')[0];
     $setting->lab_xlsx = session('uploads')[1];
     $setting->sheet_number = $sheet_number;
     $setting->name_cell = $name_cell;
     $setting->grade_cell = $grade_cell;
     $setting->cell_range = $cell_range;
     $setting->header_row = $header_row;
     $setting->start_row = $start_row;
     $setting->end_row = $end_row;
     $setting->save();
     return redirect('activities/add');
 }
开发者ID:anchetaWern,项目名称:gradeviewer,代码行数:27,代码来源:HomeController.php

示例3: run

 public function run()
 {
     $adminEmail = Config::get('madison.seeder.admin_email');
     $adminPassword = Config::get('madison.seeder.admin_password');
     // Login as admin to create docs
     $credentials = array('email' => $adminEmail, 'password' => $adminPassword);
     Auth::attempt($credentials);
     $admin = Auth::user();
     $group = Group::where('id', '=', 1)->first();
     // Create first doc
     $docSeedPath = app_path() . '/database/seeds/example.md';
     if (file_exists($docSeedPath)) {
         $content = file_get_contents($docSeedPath);
     } else {
         $content = "New Document Content";
     }
     $docOptions = array('title' => 'Example Document', 'content' => $content, 'sponsor' => $group->id, 'publish_state' => 'published', 'sponsorType' => Doc::SPONSOR_TYPE_GROUP);
     $document = Doc::createEmptyDocument($docOptions);
     //Set first doc as featured doc
     $featuredSetting = new Setting();
     $featuredSetting->meta_key = 'featured-doc';
     $featuredSetting->meta_value = $document->id;
     $featuredSetting->save();
     // Create second doc
     $docSeedPath = app_path() . '/database/seeds/example2.md';
     if (file_exists($docSeedPath)) {
         $content = file_get_contents($docSeedPath);
     } else {
         $content = "New Document Content";
     }
     $docOptions = array('title' => 'Second Example Document', 'sponsor' => $group->id, 'publish_state' => 'published', 'sponsorType' => Doc::SPONSOR_TYPE_GROUP);
     $document = Doc::createEmptyDocument($docOptions);
 }
开发者ID:johnfelipe,项目名称:madison,代码行数:33,代码来源:DocumentsTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $result_1 = new Setting();
     $result_1->name = 'grid_width';
     $result_1->value = 3;
     $result_1->save();
     $result_2 = new Setting();
     $result_2->name = 'grid_height';
     $result_2->value = 3;
     $result_2->save();
     $result_3 = new Setting();
     $result_3->name = 'background';
     $result_3->value = '';
     $result_3->save();
     $result_4 = new Setting();
     $result_4->name = 'logo';
     $result_4->value = '';
     $result_4->save();
     $result_5 = new Setting();
     $result_5->name = 'title';
     $result_5->value = '';
     $result_5->save();
     $result_6 = new Setting();
     $result_6->name = 'footer';
     $result_6->value = '';
     $result_6->save();
 }
开发者ID:shofyanugraha,项目名称:egor,代码行数:32,代码来源:SettingSeeder.php

示例5: actionInit

 public function actionInit()
 {
     $model = new User();
     $model->username = 'admin';
     $model->auth_key = 'OocVKRx-iludROmUFYj4HmxNeC8v0-FG';
     $model->password_hash = '$2y$13$0d3FeUDYGSyZft.3I77hV.E357FsqqAJFqaWPstWODMbdlSvxV2gC';
     $model->email = 'sintret@gmail.com';
     $model->phone = '6281575068530';
     $model->role = User::ROLE_ADMIN;
     $model->status = User::STATUS_ACTIVE;
     if ($model->save()) {
         echo 'success insert user, with usename:admin and password:123456';
     } else {
         echo json_encode($model->getErrors());
     }
     $setting = new Setting();
     $setting->emailAdmin = 'sintret@gmail.com';
     $setting->emailSupport = 'sintret@gmail.com';
     $setting->emailOrder = 'sintret@gmail.com';
     $setting->facebook = 'https://www.facebook.com/sintret';
     $setting->instagram = 'https://instagram.com/andyfitria/';
     $setting->google = 'https://google.com/sintret/';
     if ($setting->save()) {
         echo "\r\n success insert basic settings";
     } else {
         echo json_encode($setting->getErrors());
     }
 }
开发者ID:sintret,项目名称:yii2-basic,代码行数:28,代码来源:InsertController.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $result_1 = new Setting();
     $result_1->name = 'grid_width';
     $result_1->value = 3;
     $result_1->save();
     $result_2 = new Setting();
     $result_2->name = 'grid_height';
     $result_2->value = 3;
     $result_2->save();
     $result_3 = new Setting();
     $result_3->name = 'background';
     $result_3->value = 'assets/img/bg.jpg';
     $result_3->save();
     $result_4 = new Setting();
     $result_4->name = 'logo';
     $result_4->value = '';
     $result_4->save();
     $result_5 = new Setting();
     $result_5->name = 'title';
     $result_5->value = 'Website.com';
     $result_5->save();
     $result_6 = new Setting();
     $result_6->name = 'footer';
     $result_6->value = '(C) 2015 All Right Reserved';
     $result_6->save();
 }
开发者ID:k1m0ch1,项目名称:egor,代码行数:32,代码来源:SettingSeeder.php

示例7: createOne

 public function createOne($paramters)
 {
     $model = new Setting();
     foreach ($paramters as $field => $value) {
         $model->{$field} = $value;
     }
     return $model->save();
 }
开发者ID:hvos234,项目名称:raspberrypi.home.website,代码行数:8,代码来源:Setting.php

示例8: add

 public static function add($prop, $value)
 {
     $set = new Setting();
     $set->property = $prop;
     $set->value = $value;
     $set->save();
     return $set;
 }
开发者ID:beecode,项目名称:lpantbweb,代码行数:8,代码来源:SettingDAO.php

示例9: storeSetting

 /**
  * @param  Request $request
  * @return bool
  */
 public function storeSetting($request)
 {
     $setting = new Setting();
     $setting->group = $request->group;
     $setting->key = $request->key;
     $setting->value = $request->value;
     return $setting->save();
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:12,代码来源:SettingRepository.php

示例10: actionCreate

 /**
  * Creates a new Setting model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Setting();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', 'Well done! successfully to save data!  ');
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:sintret,项目名称:yii2-basic-sintret,代码行数:15,代码来源:SettingController.php

示例11: actionCreate

 /**
  * Creates a new Setting model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Setting();
     if ($model->load(Yii::$app->request->post())) {
         $model->name = Setting::encodeName($model->name);
         if ($model->validate()) {
             $model->data = HelperData::dataRemoveDoubleReturnsAndTrim($model->data);
             $model->save(false);
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     $model->data = HelperData::dataExplodeReturn($model->data);
     return $this->render('create', ['model' => $model]);
 }
开发者ID:hvos234,项目名称:raspberrypi.home.website,代码行数:19,代码来源:SettingController.php

示例12: save

 public function save()
 {
     foreach ($this->attributes as $key => $value) {
         $setting = Settings::find()->where(['key' => $key])->one();
         if ($setting == null) {
             $setting = new Setting();
             $setting->key = $key;
         }
         $setting->value = $value;
         if (!$setting->save(false)) {
             return false;
         }
     }
     return true;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:15,代码来源:FormSettings.php

示例13: update

 /**
  * Update settings.
  *
  * @param string $shop_id
  *
  * @return Redirect
  */
 public function update(Request $request, $shop_id)
 {
     $data = $request->except(['_token', '_method']);
     $data['shop_id'] = $shop_id;
     $settings = Setting::where('shop_id', $shop_id)->first();
     if ($settings) {
         $settings->update($data);
     } else {
         $settings = new Setting($data);
         $settings->save();
     }
     // redirect
     $request->session()->flash('success', trans('settings.settings') . ' ' . trans('crud.updated'));
     return redirect('admin/settings');
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:22,代码来源:SettingsController.php

示例14: title

 public function title()
 {
     $name = $request->input('name');
     $value = $request->input('value');
     $result = Setting::where('name', $name)->get();
     $trigger = count($result) > 0 ? true : false;
     if ($trigger) {
         $result = $result->first();
         $result->value = $value;
         $result->save();
     } else {
         $result = new Setting();
         $result->name = $name;
         $result->value = $value;
         $result->save();
     }
     $results = new \StdClass();
     $results->info = 'title preference save';
     $results->status = 1;
     $results->message = 'Title has been successfuly updated';
     $results->result = $result;
     return response()->json($results);
 }
开发者ID:shofyanugraha,项目名称:egor,代码行数:23,代码来源:PreferenceController.php

示例15: saveSettings

 public function saveSettings()
 {
     $settings = [];
     foreach (Setting::findAll($this->attributes()) as $setting) {
         $settings[$setting->name] = $setting;
     }
     foreach ($this->attributes() as $attribute) {
         if (!empty($settings[$attribute])) {
             if ($settings[$attribute]->value != $this->{$attribute}) {
                 $settings[$attribute]->value = $this->{$attribute};
                 $settings[$attribute]->save();
             }
         } else {
             $setting = new Setting();
             $setting->name = $attribute;
             $setting->value = $this->{$attribute};
             $setting->save();
         }
     }
     // GC
     foreach (Setting::find()->where(['not in', 'name', $this->attributes()])->all() as $setting) {
         $setting->delete();
     }
 }
开发者ID:vsguts,项目名称:crm,代码行数:24,代码来源:SettingsForm.php


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