本文整理匯總了PHP中Illuminate\Database\Eloquent\Collection::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::where方法的具體用法?PHP Collection::where怎麽用?PHP Collection::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Eloquent\Collection
的用法示例。
在下文中一共展示了Collection::where方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: remove
public static function remove($key)
{
if (!empty($key)) {
return self::$app_options->where('key', $key)->delete();
}
return false;
}
示例2: whereEndsWith
/**
* 當前屬性以特定字符串結尾
* @param $attribute
* @param string|null $value
* @return static
*/
public function whereEndsWith($attribute, string $value)
{
if (is_empty_string($value)) {
return $this;
}
$this->original->where($attribute, 'like', '%' . trim($value, '%'));
return $this;
}
示例3: getSetting
/**
* Return a Setting.
*
* @param string $key
*
* @return mixed
*/
public function getSetting($key)
{
if (!$this->settings) {
$this->getSettings();
}
if ($this->settings instanceof EloquentCollection && $this->settings->where('key', $this->key($key))->first()) {
return $this->settings->where('key', $this->key($key))->first();
}
return new Setting(['key' => $this->key($key), 'value' => $this->getDefaultValue($key)]);
}
示例4: get
/**
* Get a setting by its handle.
*
* @param string $handle
*
* @return Setting
*/
public function get($handle)
{
$this->setting = $this->items->where('handle', $handle)->first();
return $this->setting;
}