I have a table with input fields that act as filters. There are values from Orders table and Users table which has a relationship.
e.g.:
Order Id | User Full Name | Order Price | Date |
[order filter] [user name filter] [order date filter]
How can I filter a value from a users table via relationship?
This returns error of course:
public function name($name)
{
return $this->builder->where('name', 'LIKE', '%$name%')->orWhere('surname', 'LIKE', '%$name%');
}
Error:
QueryException in Connection.php line 770:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select count(*) as aggregate from `orders` where (`name` LIKE %$name% or `surname` LIKE %$name%))
via Rudolph