Use IS NULL when looking for missing database values
A query searches for invoices without a paid timestamp using paid_at = NULL. It returns no rows even though unpaid invoices exist. NULL represents an unknown or absent value, and ordinary equality does not produce true for that comparison.
Ask the null question explicitly
SELECT id, due_at
FROM invoices
WHERE paid_at IS NULL;
Use IS NOT NULL for the opposite condition. A zero amount, empty string, and NULL are different stored values. Do not collapse them unless the domain explicitly treats them as the same state.
Review compound conditions
SQL conditions can evaluate to unknown as well as true or false. That affects comparisons and negation. A condition that looks exhaustive in ordinary two-valued boolean reasoning may still exclude rows with NULL fields.
In Laravel, whereNull makes the intention clear. Avoid replacing NULL with a magic date such as 1970-01-01 merely to simplify one query; that introduces a fake timestamp every other consumer must interpret.
Test a paid invoice, an unpaid invoice, and any legitimate zero-value invoice. Assert the selected IDs rather than only the row count. A count can remain correct while the wrong rows are returned. When changing a nullable column to required, backfill with meaningful data or reject the migration until the missing values have a valid resolution.