Illuminate\Support\Collection::has PHP Method

has() public method

Determine if an item exists in the collection by key.
public has ( mixed $key ) : boolean
$key mixed
return boolean
    public function has($key)
    {
        return $this->offsetExists($key);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param WithInterface|DataInterface|ModelInterface $config
  * @return mixed
  */
 public function apply($config)
 {
     if (!($config instanceof WithInterface && $config instanceof DataInterface && $config instanceof ModelInterface)) {
         return;
     }
     if ($config->with()->isEmpty()) {
         return;
     }
     $this->config = $config;
     $this->allowed = $config->with();
     foreach ($this->allowed as $key => $value) {
         if (is_numeric($key)) {
             $this->allowed->forget($key)->put($value, '*');
         }
     }
     foreach (explode('|', $config->data()->get('with', '')) as $with) {
         $parts = explode(':', $with);
         if (count($parts) == 0) {
             continue;
         }
         if (!$this->allowed->has($parts[0])) {
             continue;
         }
         $this->processWith($parts[0], isset($parts[1]) ? $parts[1] : '');
     }
     if (count($this->approved) > 0) {
         $config->model($config->model()->with($this->approved));
     }
 }
All Usage Examples Of Illuminate\Support\Collection::has