Select relationship and "virtual" title attribute
Hello, I have a
Customer
model with a first_name
and last_name
field. A virtual field full_name
which represents the concat of these 2 fields.
In another resource, which has an belongsTo Customer
relationship, I'd like a select based on full_name
.
TY5 Replies
And what happens when you use
full_name
as the titleAttribute
?In
Customer
model
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customers.full_name' in 'field list'
My engine is mariadb, even if I modify the query with something like ->addSelect(DB::raw("CONCAT(customers.first_name, ' ', customers.last_name) as full_name")
, the engine doesn't allow to filter on this...you could create a virtual column
nice idea, it can solve my issue, but I'm curious if there is a way to solve that without a schema change
thanks a lot, I mark as solved!
I think the third param lets you modify the query and you could add the second where clause