當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。