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