Illuminate\Support\Collection::where PHP Method

where() public method

Filter items by the given key value pair.
public where ( string $key, mixed $operator, mixed $value = null ) : static
$key string
$operator mixed
$value mixed
return static
    public function where($key, $operator, $value = null)
    {
        if (func_num_args() == 2) {
            $value = $operator;
            $operator = '=';
        }
        return $this->filter($this->operatorForWhere($key, $operator, $value));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param $slug
  * @param $callback
  *
  * @throws \Exception
  */
 public function getDropDown($slug, $callback)
 {
     $dropDown = $this->links->where('slug', $this->snakeName($slug))->first();
     if ($dropDown) {
         call_user_func($callback, $dropDown);
     } else {
         throw new \Exception("Drop down {$slug} not found");
     }
 }
All Usage Examples Of Illuminate\Support\Collection::where