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


PHP Configure::select方法代码示例

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


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

示例1: listConfigure

 public function listConfigure()
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $start = Input::has('start') ? (int) Input::get('start') : 0;
     $length = Input::has('length') ? Input::get('length') : 10;
     $search = Input::has('search') ? Input::get('search') : [];
     $configures = Configure::select('id', 'cname', 'ckey', 'cvalue', 'cdescription', 'active')->whereNotIn('ckey', ['title_site', 'meta_description', 'main_logo', 'favicon', 'mask'])->where('ckey', 'not like', 'email_%');
     if (!empty($search)) {
         foreach ($search as $key => $value) {
             if (empty($value)) {
                 continue;
             }
             if ($key == 'active') {
                 if ($value == 'yes') {
                     $value = 1;
                 } else {
                     $value = 0;
                 }
                 $configures->where($key, $value);
             } else {
                 $value = ltrim(rtrim($value));
                 $configures->where($key, 'like', '%' . $value . '%');
             }
         }
     }
     $order = Input::has('order') ? Input::get('order') : [];
     if (!empty($order)) {
         $columns = Input::has('columns') ? Input::get('columns') : [];
         foreach ($order as $value) {
             $column = $value['column'];
             if (!isset($columns[$column]['name']) || empty($columns[$column]['name'])) {
                 continue;
             }
             $configures->orderBy($columns[$column]['name'], $value['dir'] == 'asc' ? 'asc' : 'desc');
         }
     }
     $count = $configures->count();
     if ($length > 0) {
         $configures = $configures->skip($start)->take($length);
     }
     $arrConfigures = $configures->get()->toArray();
     $arrReturn = ['draw' => Input::has('draw') ? Input::get('draw') : 1, 'recordsTotal' => Configure::count(), 'recordsFiltered' => $count, 'data' => []];
     if (!empty($arrConfigures)) {
         foreach ($arrConfigures as $configure) {
             $arrReturn['data'][] = array(++$start, $configure['id'], $configure['cname'], $configure['ckey'], $configure['cvalue'], $configure['cdescription'], $configure['active']);
         }
     }
     $response = Response::json($arrReturn);
     $response->header('Content-Type', 'application/json');
     return $response;
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:53,代码来源:ConfiguresController.php

示例2: getConfig

 public static function getConfig()
 {
     $arrReturn = [];
     $arrConfig = Configure::select('ckey', 'cvalue')->where('ckey', 'like', 'email_%')->get();
     foreach ($arrConfig as $configure) {
         $arrReturn[str_replace('email_', '', $configure->ckey)] = $configure->cvalue;
     }
     if (isset($arrReturn['username'])) {
         $arrReturn['from']['address'] = $arrReturn['username'];
     }
     if (isset($arrReturn['name'])) {
         $arrReturn['from']['name'] = $arrReturn['name'];
     }
     return array_merge(Config::get('mail'), $arrReturn);
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:15,代码来源:VIEmail.php

示例3: getMetaInfo

 public static function getMetaInfo()
 {
     $arrData = [];
     if (Cache::has('meta_info')) {
         $arrData = Cache::get('meta_info');
     } else {
         $arrMeta = ['title_site', 'meta_description', 'main_logo', 'favicon'];
         $configures = Configure::select('ckey', 'cvalue')->whereIn('ckey', ['title_site', 'meta_description', 'main_logo', 'favicon'])->get();
         foreach ($configures as $configure) {
             $arrData[$configure['ckey']] = $configure['cvalue'];
         }
         foreach ($arrMeta as $key) {
             if (!isset($arrData[$key])) {
                 $arrData[$key] = '';
             }
         }
         Cache::forever('meta_info', $arrData);
     }
     return $arrData;
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:20,代码来源:Home.php


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