本文整理匯總了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);
}
示例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);
}