whereIs() and orWhereIs()
The whereIs()
method adds a WHERE column = value
condition using a strict and semantic syntax.
It behaves like where($column, '=', $value)
, but provides cleaner intent and additional safety checks for valid column names.
Signature:
public function whereIs(string $column, mixed $value): self
public function orWhereIs(string $column, mixed $value): self
Basic Usage
Find all records with exact value match:
$db->whereIs('status', 'active');
$users = $db->get('users');
Another example with a numeric value:
$db->whereIs('id', 123);
$record = $db->getOne('products');
Column Validation
This method requires the column name to be a valid, safe identifier (alphanumeric with optional dots).
Invalid or dangerous field names will trigger an InvalidArgumentException
.
orWhereIs()
Behaves exactly like whereIs()
, but adds the condition using OR
instead of AND
.