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


PHP Setting::where方法代码示例

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


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

示例1: getSettings

 /**
  * @return array
  */
 public function getSettings()
 {
     $obj = $this->setting->where('lang', getLang())->first() ?: $this->setting;
     $jsonData = $obj->settings;
     $setting = json_decode($jsonData, true);
     if ($setting === null) {
         $setting = array('site_title' => null, 'ga_code' => null, 'meta_keywords' => null, 'meta_description' => null);
     }
     return $setting;
 }
开发者ID:MehmetNuri,项目名称:fullycms,代码行数:13,代码来源:SettingRepository.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST /settings
  *
  * @return Response
  */
 public function store()
 {
     $response = new stdClass();
     $statusCode = 201;
     $in = Input::only('email', 'subscription', 'phone');
     $rules = array('email' => 'required | email | unique:settings', 'subscription' => 'boolean');
     // 先檢查身分
     $authId = Auth::user()->id;
     $email = User::where(array('id' => $authId, 'email' => $in['email']))->pluck('email');
     $vd = Validator::make($in, $rules);
     if ($vd->fails()) {
         $errs = $vd->messages();
         $statusCode = 400;
         if ($errs->has('email')) {
             if ($email == $in['email']) {
                 $setting = Setting::where(array('email' => $in['email']));
                 if (!$setting->update($in)) {
                     $statusCode = 304;
                     $response = $errs->all();
                 } else {
                     $statusCode = 200;
                 }
             }
         }
     } else {
         if ($email == $in['email']) {
             $response = Setting::firstOrCreate($in);
         } else {
             $statusCode = 403;
         }
     }
     return Response::json($response, $statusCode);
 }
开发者ID:htchien,项目名称:prayerweb,代码行数:39,代码来源:SettingsController.php

示例3: set

 /**
  * Store setting
  *
  * @param $key
  * @param $value
  * @return bool
  */
 public function set($key, $value)
 {
     /**
      * Setup cache key
      */
     $cacheKey = 'setting_' . md5($key);
     /**
      * Fetch from database
      */
     $setting = Setting::where('key', '=', $key)->first();
     /**
      * If nothing was found, create a new object
      */
     if (!is_object($setting)) {
         $setting = new Setting();
     }
     /**
      * Set the values
      */
     $setting->setKey($key)->setValue($value)->save();
     /**
      * Expire the cache
      */
     \Cache::forget($cacheKey);
     return true;
 }
开发者ID:codepeak,项目名称:dsettings,代码行数:33,代码来源:DSetting.php

示例4: getFeaturedAttribute

 public function getFeaturedAttribute()
 {
     $featuredSetting = Setting::where('meta_key', '=', 'featured-doc')->first();
     if ($featuredSetting) {
         return $featuredSetting->meta_value == $this->id;
     }
     return false;
 }
开发者ID:ritvikgautam,项目名称:madison,代码行数:8,代码来源:Doc.php

示例5: rule

 /**
  * @return string rule
  */
 public static function rule($name = '')
 {
     $setting = Setting::where('name', '=', $name)->first();
     if (is_object($setting[0])) {
         return $setting->rule;
     } else {
         return false;
     }
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:12,代码来源:Setting.php

示例6: scopeKey

 public function scopeKey($query, $key)
 {
     if (count(Setting::where('key', '=', $key)->get()) == 0) {
         $setting = Setting::firstOrNew(['key' => $key]);
         $setting->value = '';
         $setting->save();
     }
     return $query->where('key', '=', $key);
 }
开发者ID:pombredanne,项目名称:licenser-7,代码行数:9,代码来源:Setting.php

示例7: get_tz

 private function get_tz()
 {
     if (!$this->tz) {
         $s = new Setting();
         $s->where('name', 'site_timezone')->get();
         $this->tz = $s->value;
     }
     return $this->tz;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:9,代码来源:koken.php

示例8: getEmployeeSettingByEmployeeId

 public function getEmployeeSettingByEmployeeId($employeeId = '')
 {
     if (empty($employeeId)) {
         $employeeId = Session::get('userEmployeeId');
     } else {
         $employeeId = (int) $employeeId;
     }
     return Setting::where('employee_id', '=', $employeeId)->first();
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:9,代码来源:Setting.php

示例9: Setting

 function get_val($key)
 {
     $setting = new Setting();
     //$query = $this->db->get_where($this->table, array("name" => $key));
     //if ($query->num_rows() > 0){
     //$row = $query->row();
     //return $row->val;
     //}
     $result = $setting->where("name", $key)->get();
     return $result->val;
 }
开发者ID:anggadjava,项目名称:payroll,代码行数:11,代码来源:setting.php

示例10: putSetting

 public function putSetting($name, $value = 0)
 {
     $setting = Setting::where('name', '=', $name)->first();
     if (isset($setting->id)) {
         Setting::where('name', $name)->update(array('value' => $value));
     } else {
         $this->name = $name;
         $this->value = $value;
         $this->save();
     }
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:11,代码来源:Setting.php

示例11: Setting

 function after_content_create($content)
 {
     $s = new Setting();
     $s->where('name', 'uploading_publish_on_captured_date')->get();
     if ($s->exists() && $s->value === 'true') {
         $fresh = new Content();
         $fresh->get_by_id($content['id']);
         $fresh->published_on = $content['captured_on']['utc'] ? $content['captured_on']['timestamp'] : 'captured_on';
         $fresh->save();
     }
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:11,代码来源:plugin.php

示例12: sil

 public function sil($id)
 {
     $settings = Setting::find($id);
     if ($settings->active == 1) {
         Setting::where('id', '=', 1)->update(['active' => 1]);
     }
     if ($settings->delete()) {
         return Redirect::back()->withInput()->with(array('basarili' => 'Ayar başarı ile silindi.'));
     } else {
         return Redirect::back()->withInput()->with(array('hata' => 'Ayar başarı ile silinemedi.'));
     }
 }
开发者ID:KaptanJack61,项目名称:fnplus,代码行数:12,代码来源:SiteYonetimiController.php

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

示例14: decrease

 public static function decrease($name = false)
 {
     if (!$name) {
         return false;
     }
     $set = Setting::where('name', $name)->first();
     if (is_object($set)) {
         $set->value = $set->value > 0 ? $set->value - 1 : 0;
         $set->save();
         $set->touch();
     } else {
         Setting::create(array('name' => $name, 'value' => 0));
     }
     return true;
 }
开发者ID:Grapheme,项目名称:amway,代码行数:15,代码来源:Settings.php

示例15: update

 function update()
 {
     $setting = new Setting();
     // upload photo
     $config['upload_path'] = 'assets/upload';
     $config['allowed_types'] = 'gif|jpg|png|bmp';
     $this->load->library("upload", $config);
     if ($this->upload->do_upload("logo")) {
         $data = $this->upload->data();
         //print_r($data["file_name"]);
         //$setting->logo = $data["file_name"];
     } else {
         //print_r($this->upload->display_errors());
     }
     $setting->where('id', $this->input->post('id'))->update(array('logo' => $data["file_name"], 'company_name' => $this->input->post('company_name'), 'address' => $this->input->post('address'), 'phone' => $this->input->post('phone'), 'fax' => $this->input->post('fax'), 'email' => $this->input->post('email'), 'city' => $this->input->post('city'), 'no_npwp' => $this->input->post('no_npwp')));
     $this->session->set_flashdata('message', 'Config Update successfuly.');
     redirect('settings/edit/1');
 }
开发者ID:anggadjava,项目名称:payroll,代码行数:18,代码来源:settings.php


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