Skip to content

Is Greater Than Equal To

Gilberto Junior edited this page Nov 29, 2019 · 7 revisions

Operators

Is Greater Than

A operator that represents the field's value is greater than another value.

Syntax

public function isGreaterThan(string $column, string|int|float $value): self;

Alias

public function gt(string $column, string|int|float $value): self;

Example 1

PHP's way:

$repository->isGreaterThan('age', 18);

SQL's Representation:

WHERE age > 18;

Example 2

PHP's way:

$repository->gt('price', 1.99);

SQL's Representation:

WHERE price > 1.99;

Example 3

PHP's way:

$repository->isGreaterThan('age', 18)
    ->orIsGreaterThan('birth_date', '2019-10-02');

SQL's Representation:

WHERE age > 18 OR birth_date > '2019-10-02';

Example 4

PHP's way:

$repository->gt('price', 0.01)
    ->orGt('id', 999);

SQL's Representation:

WHERE price > 0.01 OR id > 999;

Is Greater Than Equal To

A operator that represents the field's value is greater than equal to another value.

Syntax

public function isGreaterThanEqualTo(string $column, string|int|float $value): self;

Alias

public function gte(string $column, string|int|float $value): self;

Example 1

PHP's way:

$repository->isGreaterThanEqualTo('id', 10);

SQL's Representation:

WHERE id >= 10;

Example 2

PHP's way:

$repository->gte('size', 999);

SQL's Representation:

WHERE size >= 999;

Example 3

PHP's way:

$repository->isGreaterThanEqualTo('price', 100)
    ->orIsGreaterThanEqualTo('quantity', 999);

SQL's Representation:

WHERE price >= 100 OR quantity >= 999;

Example 4

PHP's way:

$repository->gte('score', 1000)
    ->orGte('age', 18);

SQL's Representation:

WHERE score >= 1000 OR age >= 18;

🡄 Like Or Not | Is Less Than Equal To 🡆