Refine for Laravel
A package by Hammerstone

Text Condition

Refine is a paid package. To purchase, head to

The TextCondition is for columns that hold strings. In its basic form it looks like this:


This condition has an id of name, is applied against a column of name, and has a display value to the end user of "Name".

The TextCondition provides a number of clauses that let your users filter down to records that start with, end with, contain, or are exactly equal to what they're looking for. See below for more detail on each clause.


The TextCondition will automatically validate that the user's input is present, and because it uses the HasClauses trait, the clause will be validated to ensure it is one that you've allowed.


Below you'll see all of the clauses available on the TextCondition.

To read more general information about clauses, head over to the clauses page.


The attribute exactly matches what the user has entered.


The attribute doesn't match what the user has entered, or the attribute is null.

The simplest way to represent "doesn't equal" in SQL would be attribute != "value". This however will not return any records where attribute is null.

So if your attribute is a nullable column, e.g. $table->string("title")->nullable() and your users are looking for "Employees where [title] [does not equal] [manager]", we have to add the or title is null to accurately represent what the user is looking for.


The attribute starts with the value the user entered.


The attribute does not start with the value the user entered.


The attribute ends with the value the user entered.


The attribute does not end with the value the user entered.


The attribute contains the value the user entered.


The attribute doesn't contain the value the user entered, or is null. (See CLAUSE_DOESNT_EQUAL for reasoning.)


The attribute is not null and not an empty string ('').


The attribute is null or is an empty string ('').