Skip to content

Is Less Than Equal To

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

Operators

Is Less Than

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

Syntax

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

Alias

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

Example 1

PHP's way:

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

SQL's Representation:

WHERE age < 18;

Example 2

PHP's way:

$repository->lt('price', 199.99);

SQL's Representation:

WHERE price < 199.99;

Example 3

PHP's way:

$repository->isLessThan('age', 18)
    ->orIsLessThan('birth_date', '2019-10-02');

SQL's Representation:

WHERE age <= 18 OR birth_date <= '2019-10-02';

Example 4

PHP's way:

$repository->lt('price', 0.01)
    ->orLt('id', 999);

SQL's Representation:

WHERE price < 0.01 OR id < 999;

Is Less Than Equal To

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

Syntax

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

Alias

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

Example 1

PHP's way:

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

SQL's Representation:

WHERE id <= 10;

Example 2

PHP's way:

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

SQL's Representation:

WHERE size <= 999;

Example 3

PHP's way:

$repository->isLessThanEqualTo('price', 100)
    ->orIsLessThanEqualTo('quantity', 999);

SQL's Representation:

WHERE price <= 100 OR quantity <= 999;

Example 4

PHP's way:

$repository->lte('score', 1000)
    ->orLte('age', 18);

SQL's Representation:

WHERE score <= 1000 OR age <= 18;

🡄 Is Greater Than Equal To | Is Null Or Not 🡆