Example #1
0
 /**
  * Filter the array using the given Closure.
  *
  * @param  array     $array
  * @param  \Closure  $callback
  * @return array
  */
 function array_where($array, Closure $callback)
 {
     return Arr::where($array, $callback);
 }
Example #2
0
 /**
  * Run a filter over each of the items.
  *
  * @param  callable|null  $callback
  * @return static
  */
 public function filter(callable $callback = null)
 {
     if ($callback) {
         return new static(Arr::where($this->items, $callback));
     }
     return new static(array_filter($this->items));
 }