My my columns.yaml
file for the Invoice
model I have the following column:
transaction[user][email]:
label: Login email
type: text
searchable: true // doesn't work!
Unfortunately, the searchable
bit doesn't work and I understand that this is because I am using transaction[user][email]
instead of having a relation
and select
as part of the column.
My question is, can I somehow use relation
and select
when I'm going 2 relations deep, like this, or do I need a different approach?
My Invoice
model has this relation defined:
public $morphOne = [
'transaction' => ['Namespace\Plugin\Models\Transaction', 'name' => 'transactionable']
];
And my Transaction
model has this relation defined:
public $belongsTo = [
'user' => ['Rainlab\User\Models\User'],
];
So, essentially, I want to be able have a backend list of invoices with the user's email address showing in one of the columns, and also make it possible for an email address to be entered in the search box in order to filter the list only for invoices associated with the user with that email address.