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


PHP models\Setting类代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例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 = '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

示例5: actionIndex

 public function actionIndex()
 {
     $setting = new Setting();
     $data['siteName'] = $setting->getSiteName()->value;
     $data['address'] = $setting->getAddress()->value;
     $data['nickName'] = $setting->getNickName()->value;
     $data['desc'] = $setting->getDesc()->value;
     return $this->render('index', ['info' => $data]);
 }
开发者ID:tqsq2005,项目名称:blog-cms,代码行数:9,代码来源:IndexController.php

示例6: 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

示例7: 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

示例8: 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

示例9: actionSetmail

 public function actionSetmail()
 {
     $model = new Setting();
     $message = true;
     $query = Setting::find()->one();
     if (Yii::$app->request->post()) {
         $request = Yii::$app->request;
         $password = $request->post('Setting')['password'];
         $username = $request->post('Setting')['username'];
         $sendhost = $request->post('Setting')['sendhost'];
         $sendport = $request->post('Setting')['sendport'];
         $user = $request->post('Setting')['user'];
         $receivehost = $request->post('Setting')['receivehost'];
         $receiveport = $request->post('Setting')['receiveport'];
         $model1 = new Receive();
         $obj = new receiveMail($user, $password, $username, $receivehost, 'imap', '993', 'ture');
         if ($obj->connect()) {
             $query = Setting::find()->one();
             $query->sendhost = $sendhost;
             $query->sendport = $sendport;
             $query->user = $user;
             $query->password = $password;
             $query->username = $username;
             $query->receivehost = $receivehost;
             $query->receiveport = $receiveport;
             $query->save();
             return $this->render('setting', ['model' => $model, 'settingMessage' => $query, 'message' => $message]);
         } else {
             $message = false;
             return $this->render('setting', ['model' => $model, 'settingMessage' => $query, 'message' => $message]);
         }
     } else {
         return $this->render('setting', ['model' => $model, 'settingMessage' => $query, 'message' => $message]);
     }
 }
开发者ID:huangjiaozhu,项目名称:OSup-,代码行数:35,代码来源:AdminController.php

示例10: sync

 /**
  * Sync the media. Oh sync the media.
  *
  * @param string|null $path
  * @param array       $tags        The tags to sync.
  *                                 Only taken into account for existing records.
  *                                 New records will have all tags synced in regardless.
  * @param bool        $force       Whether to force syncing even unchanged files
  * @param SyncMedia   $syncCommand The SyncMedia command object, to log to console if executed by artisan.
  */
 public function sync($path = null, $tags = [], $force = false, SyncMedia $syncCommand = null)
 {
     if (!app()->runningInConsole()) {
         set_time_limit(env('APP_MAX_SCAN_TIME', 600));
     }
     $path = $path ?: Setting::get('media_path');
     $this->setTags($tags);
     $results = ['good' => [], 'bad' => [], 'ugly' => []];
     $getID3 = new getID3();
     foreach ($this->gatherFiles($path) as $file) {
         $file = new File($file, $getID3);
         $song = $file->sync($this->tags, $force);
         if ($song === true) {
             $results['ugly'][] = $file;
         } elseif ($song === false) {
             $results['bad'][] = $file;
         } else {
             $results['good'][] = $file;
         }
         if ($syncCommand) {
             $syncCommand->logToConsole($file->getPath(), $song);
         }
     }
     // Delete non-existing songs.
     $hashes = array_map(function ($f) {
         return self::getHash($f->getPath());
     }, array_merge($results['ugly'], $results['good']));
     Song::whereNotIn('id', $hashes)->delete();
     // Trigger LibraryChanged, so that TidyLibrary handler is fired to, erm, tidy our library.
     event(new LibraryChanged());
 }
开发者ID:carriercomm,项目名称:koel,代码行数:41,代码来源:Media.php

示例11: actionSendChat

 public function actionSendChat()
 {
     if (!empty($_POST)) {
         echo \sintret\chat\ChatRoom::sendChat($_POST);
         $message = Yii::$app->user->identity->username . ' : ' . $_POST['message'];
         $pos = strpos($message, "@");
         $setting = \app\models\Setting::findOne(1);
         if ($pos !== FALSE) {
             // $w = new WhatsApp($number, $app, $password);
             $usernameSendgrid = $setting->sendgridUsername;
             $passwordSendgrid = $setting->sendgridPassword;
             $users = \app\models\User::find()->where(['status' => \app\models\User::STATUS_ACTIVE])->all();
             foreach ($users as $model) {
                 $aprot = '@' . strtolower($model->username);
                 if (strpos($message, $aprot) !== false) {
                     $sendgrid = new \SendGrid($usernameSendgrid, $passwordSendgrid, array("turn_off_ssl_verification" => true));
                     $email = new \SendGrid\Email();
                     $email->addTo($model->email)->setFrom($setting->emailSupport)->setSubject('Chat from ' . $setting->applicationName)->setHtml($message);
                     $sendgrid->send($email);
                 } else {
                 }
             }
         }
     }
 }
开发者ID:sintret,项目名称:yii2-basic-sintret,代码行数:25,代码来源:AjaxController.php

示例12: stream

 /**
  * Stream the current song using nginx's X-Accel-Redirect.
  */
 public function stream()
 {
     header('X-Accel-Redirect: ' . str_replace(Setting::get('media_path'), '/media/', $this->song->path));
     header("Content-Type: {$this->contentType}");
     header('Content-Disposition: inline; filename="' . basename($this->song->path) . '"');
     exit;
 }
开发者ID:Youkieyh,项目名称:koel,代码行数:10,代码来源:XAccelRedirectStreamer.php

示例13: home

 protected function home()
 {
     $bigevent = [];
     $settings = Setting::all();
     foreach ($settings as $setting) {
         $arr = ['name' => $setting['name'], 'value' => $setting['value']];
         if (substr($setting['key'], 0, 3) === "be-") {
             $bigevent[$setting['key']] = $arr;
         } else {
             $other[$setting['key']] = $arr;
         }
     }
     //BEAUCOUPS D'APPELS A LA BDD, CERTES EN HAUT C'EST PAS FORCEMENT MIEUX, de tout facon faudra faire un systeme de "event mis en avant" en faisant les events.
     /*
     	$about = Setting::where('key', 'about')->first();
     	$bigevent["main-photo"] = Setting::where('key', 'be-main-photo')->first()->value;
     	$bigevent["bg-photo"] = Setting::where('key', 'be-bg-photo')->first()->value;
     	$bigevent["title"] = Setting::where('key', 'be-title')->first()->value;
     	$bigevent["label"] = Setting::where('key', 'be-label')->first()->value;
     	$bigevent["description"] = Setting::where('key', 'be-description')->first()->value;
     	$bigevent["link"] = Setting::where('key', 'be-link')->first()->value;
     	$agenda = Setting::where('key', 'agenda')->first()->value;
     	$posts = ClubPost::all();
     	return view('home')->with([
     		'about' => $about->value,
     		'posts' => $posts,
     		'bigevent' => $bigevent,
     		'agenda' => $agenda]);
     */
     $posts = ClubPost::all();
     return view('home')->with(['posts' => $posts, 'bigevent' => $bigevent, 'other' => $other]);
 }
开发者ID:bde42,项目名称:website_v2_laravel,代码行数:32,代码来源:BaseController.php

示例14: __construct

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function __construct()
 {
     $setting = Models\Setting::first();
     $this->data['menu'] = Models\Menu::with('child')->where('level', 0)->get();
     $this->data['berita'] = Models\Berita::orderBy('id_berita', 'desc')->limit(6)->get();
     $this->data['pengumuman'] = Models\Pengumuman::orderBy('tanggal', 'desc')->limit(10)->get();
     $this->data['agenda'] = Models\Agenda::orderBy('tgl_posting', 'desc')->limit(5)->get();
     $this->data['polling'] = Models\Polling::with('jawaban')->where('status', 'Y')->limit(1)->first();
     $this->data['title'] = $setting->title_web;
     $this->data['desc'] = $setting->desc_web;
     $this->data['key'] = $setting->key_web;
     $this->data['logo'] = $setting->logo;
     $this->data['header_img'] = $setting->bg_header;
     $this->data['icon'] = $setting->favicon;
     $this->data['facebook'] = $setting->facebook;
     $this->data['peta_latitude'] = $setting->peta_latitude;
     $this->data['peta_longitude'] = $setting->peta_longitude;
     $this->data['twitter'] = $setting->twitter;
     $this->data['gplus'] = $setting->gplus;
     $this->data['slider_home'] = Models\Berita::orderBy('tanggal', 'desc')->limit(5)->get();
     $this->data['galeri_home'] = Models\Foto::OrderBy('id_foto', 'desc')->paginate(9);
     $this->data['opini_home'] = Models\Berita::where('kategori_berita', 5)->orderBy('id_berita', 'desc')->limit(6)->get();
     $this->data['banner'] = Models\Banner::where('id', 1)->first();
     $this->data['link'] = Models\Link::orderBy('id', 'desc')->limit(5)->get();
     $this->data['publikasi'] = Models\Publikasi::orderBy('id', 'desc')->limit(3)->get();
     $this->data['setting'] = $setting;
 }
开发者ID:brutalcrozt,项目名称:SI-Sekolah-L5,代码行数:32,代码来源:FrontController.php

示例15: init

 public function init()
 {
     // actions
     // translate
     foreach ($this->actions as $actions => $name) {
         $this->actions[$actions] = Yii::t('app', $name);
     }
     // actions values
     $this->actions_values['taskdefined'] = TaskDefined::getAllIdName();
     $this->actions_values['setting'] = Setting::getAllIdName();
     $this->actions_values['rule'] = Rule::getAllIdName();
     $this->actions_values['rulevalue'] = RuleValue::getAllIdName();
     $this->actions_values['ruleextra'] = RuleExtra::getAllIdName();
     $this->actions_values['ruledate'] = RuleDate::getAllIdName();
     // values
     // translate
     foreach ($this->values as $values => $name) {
         $this->values[$values] = Yii::t('app', $name);
     }
     // values_values
     $this->values_values['taskdefined'] = TaskDefined::getAllIdName();
     $this->values_values['setting'] = Setting::getAllIdName();
     $this->values_values['rule'] = Rule::getAllIdName();
     $this->values_values['rulevalue'] = RuleValue::getAllIdName();
     $this->values_values['ruleextra'] = RuleExtra::getAllIdName();
     $this->values_values['ruledate'] = RuleDate::getAllIdName();
     //$this->values = array_merge($modelRule->values, $modelRule->actions);
     //$this->values_values = $modelRule->values;
     // create weights from 0 to 5
     for ($weight = 0; $weight <= 4; $weight++) {
         $this->weights[$weight] = $weight;
     }
     parent::init();
 }
开发者ID:hvos234,项目名称:raspberrypi.home.website,代码行数:34,代码来源:RuleAction.php


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