本文整理汇总了PHP中Illuminate\Database\Eloquent\Collection::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::has方法的具体用法?PHP Collection::has怎么用?PHP Collection::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Collection
的用法示例。
在下文中一共展示了Collection::has方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMeta
/**
* Set a meta value by key
*
* @param $key
* @param $value
*/
public function setMeta($key, $value)
{
$this->loadMetaData();
if ($this->metaData->has($key)) {
$this->metaData[$key]->value = $value;
} else {
$this->metaData[$key] = $this->newMetaModel(['key' => $key, 'value' => $value]);
}
}
示例2: settingGetType
/**
* @param array $setting
* @return mixed
* @throws Exception
*/
protected function settingGetType(array $setting)
{
if (!static::$types) {
static::$types = ThemeSettingType::all()->keyBy('name');
}
if (!static::$types->has($setting['type'])) {
throw new Exception('Invalid setting type provided');
}
return static::$types->get($setting['type']);
}
示例3: hasPermission
/**
* Determine whether the authenticated user has the given permission.
*
* @param string $permission
* @param bool $for_artists
*
* @return boolean
*/
public function hasPermission($permission, $for_artists = null)
{
// If the permissions haven't been loaded yet, load them first so that
// we can check for the required permission.
if (!$this->permissions) {
$this->permissions(Which::section(), $for_artists);
}
return $this->permissions->has($permission);
}