Beispiel #1
0
 /**
  * Run a filter over each of the items.
  *
  * @param callable|null $callback
  *
  * @return static
  */
 public function filter(callable $callback = null) : Collection
 {
     if ($callback) {
         return new static(Arr::where($this->items, $callback));
     }
     return new static(array_filter($this->items));
 }