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