當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Setting::orderBy方法代碼示例

本文整理匯總了PHP中app\models\Setting::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Setting::orderBy方法的具體用法?PHP Setting::orderBy怎麽用?PHP Setting::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Setting的用法示例。


在下文中一共展示了Setting::orderBy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCacheMap

 /**
  * @return array
  */
 public function getCacheMap()
 {
     $settings = Setting::orderBy('group')->orderBy('key')->select('group', 'key', 'value')->get();
     $settings = $settings->groupBy('group');
     $map = [];
     foreach ($settings as $groupName => $groupSettings) {
         foreach ($groupSettings as $setting) {
             $map[$groupName][$setting->key] = $setting->value;
         }
     }
     return collect($map);
 }
開發者ID:jaumesala,項目名稱:opendata-maps,代碼行數:15,代碼來源:SettingRepository.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $parray = array('circuit_stewards', 'treasurer', 'superintendent', 'circuit_secretary', 'site_editors', 'supervisor_of_studies', 'local_preachers_secretary');
     $settings = Setting::orderBy('category')->orderBy('setting_field')->get();
     foreach ($settings as $setting) {
         if (!in_array($setting->setting_field, $parray)) {
             $data[$setting->category][$setting->setting_field] = $setting->setting_value;
         } else {
             $data[$setting->category][$setting->setting_field] = "";
             $indarray = explode(',', $setting->setting_value);
             foreach ($indarray as $ind) {
                 if ($data[$setting->category][$setting->setting_field] != "") {
                     $data[$setting->category][$setting->setting_field] .= ", ";
                 }
                 $indiv = Individual::find($ind);
                 $data[$setting->category][$setting->setting_field] .= $indiv->title . " " . $indiv->firstname . " " . $indiv->surname;
             }
         }
     }
     return View::make('settings.index', $data);
 }
開發者ID:bishopm,項目名稱:circuit,代碼行數:26,代碼來源:SettingsController.php


注:本文中的app\models\Setting::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。