本文整理汇总了PHP中unknown::has方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::has方法的具体用法?PHP unknown::has怎么用?PHP unknown::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::has方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paginate
/**
* Paginate the given criteria
* @param Builder $criteria
* @param unknown $columns
* @return \App\Core\PaginatorCore
*/
public function paginate($criteria, $columns = ['*'])
{
if ($criteria instanceof Illuminate\Database\Eloquent\Builder) {
$builder = $criteria->getQuery();
} else {
$builder = $criteria;
}
$pageName = 'page';
$sortColumn = '';
$sortOrder = '';
$default = config('system.page_limit');
$total = $builder->getCountForPagination();
if (!is_null($this->request) && $this->request->has('page_limit')) {
$perPage = $this->request->has('page_limit') ? $this->request->get('page_limit') : $default;
$page = $this->request->has($pageName) ? $this->request->get($pageName) : null;
$sortColumn = $this->request->has('sort') ? $this->request->get('sort') : '';
$sortOrder = $this->request->has('order') ? $this->request->get('order') : '';
} else {
$perPage = $default;
}
$builder->forPage($page = Paginator::resolveCurrentPage($pageName), $perPage);
if ($sortColumn) {
$sortOrder = $sortOrder ? $sortOrder : $this->defaultSort;
$criteria = $builder->orderBy($sortColumn, $sortOrder);
}
return new PaginatorCore($builder->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName, 'sortColumn' => $sortColumn, 'sortOrder' => $sortOrder]);
}
示例2: has
/**
* Check if the locale is available.
*
* @param string $locale
*/
public function has($locale)
{
$this->initStorage();
// Normalize locale
$locale = str_replace('_', '-', $locale);
if ($this->storage->has($locale)) {
return true;
}
// Default locale is always allowed
if (strcasecmp($locale, $this->getDefaultLocale()) === 0) {
return true;
}
return false;
}
示例3: clear
/**
* Clear data filter from session
* @param string $key
*/
protected function clear($key = '')
{
$data = $this->session->get('filters');
if ($this->request->has('clear_filter')) {
if (isset($data[$this->request->getPathInfo()])) {
$this->session->set('filters.' . $this->request->getPathInfo(), '');
}
} elseif ($key) {
if (isset($data[$this->request->getPathInfo()][$key])) {
unset($data[$this->request->getPathInfo()][$key]);
$this->session->set('filters', $data);
}
}
}
示例4: has
/**
* Check if the cart has a specific item
*
* @param string $itemIdentifier The unique item identifier
* @return boolean Yes or no?
*/
public function has($itemIdentifier)
{
return $this->store->has($itemIdentifier);
}