Illuminate\Support\Collection::operatorForWhere PHP Method

operatorForWhere() protected method

Get an operator checker callback.
protected operatorForWhere ( string $key, string $operator, mixed $value ) : Closure
$key string
$operator string
$value mixed
return Closure
    protected function operatorForWhere($key, $operator, $value)
    {
        return function ($item) use($key, $operator, $value) {
            $retrieved = data_get($item, $key);
            switch ($operator) {
                default:
                case '=':
                case '==':
                    return $retrieved == $value;
                case '!=':
                case '<>':
                    return $retrieved != $value;
                case '<':
                    return $retrieved < $value;
                case '>':
                    return $retrieved > $value;
                case '<=':
                    return $retrieved <= $value;
                case '>=':
                    return $retrieved >= $value;
                case '===':
                    return $retrieved === $value;
                case '!==':
                    return $retrieved !== $value;
            }
        };
    }