Illuminate\Support\Collection::offsetExists PHP Method

offsetExists() public method

Determine if an item exists at an offset.
public offsetExists ( mixed $key ) : boolean
$key mixed
return boolean
    public function offsetExists($key)
    {
        return array_key_exists($key, $this->items);
    }

Usage Example

Beispiel #1
0
 /**
  * @param string|Model $model
  * @param string       $query
  * @param int|null     $perPage
  * @param string       $pageName
  *
  * @return LengthAwarePaginator|Collection
  * @throws \Exception
  */
 public function searchIn($model, $query = "", $perPage = null, $pageName = 'page')
 {
     if ($model instanceof Model) {
         $model = get_class($model);
     }
     if (!$this->models->offsetExists($model)) {
         throw new \Exception("Search engine for model [{$model}] not found");
     }
     return $this->_search([$this->models->get($model)], $query = "", $perPage = null, $pageName = 'page');
 }
All Usage Examples Of Illuminate\Support\Collection::offsetExists