Skip to content

Like Or Not

Gilberto Junior edited this page Nov 29, 2019 · 1 revision

Operators

Like

A operator that compares strings.

Syntax

public function like(string $column, string $value): self;

Example 1

PHP's way:

$repository->like('name', 'Joe Doe');

SQL's Representation:

WHERE name LIKE 'Joe Doe';

Example 2

PHP's way:

$repository->like('name', 'Joe%');

SQL's Representation:

WHERE name LIKE 'Joe%';

Example 3

PHP's way:

$repository->like('name', '%Doe');

SQL's Representation:

WHERE name LIKE '%Doe';

Example 4

PHP's way:

$repository->like('name', '%oe%');

SQL's Representation:

WHERE name LIKE '%oe%';

Not Like

The opposite of LIKE.

Syntax

public function notLike(string $column, string $value): self;

Example 1

PHP's way:

$repository->notLike('name', 'Joe Doe');

SQL's Representation:

WHERE name LIKE 'Joe Doe';

Example 2

PHP's way:

$repository->notLike('name', 'Joe%');

SQL's Representation:

WHERE name NOT LIKE 'Joe%';

Example 3

PHP's way:

$repository->notLike('name', '%Doe');

SQL's Representation:

WHERE name NOT LIKE '%Doe';

Example 4

PHP's way:

$repository->notLike('name', '%oe%');

SQL's Representation:

WHERE name NOT LIKE '%oe%';

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