AJAX search on columns from another table
AJAX search on columns from another table
I have columns on a datatable that are from a product
table and other columns from an attribute_values
table. The attributes
table is related to the attribute_values
table via the foreign key attribute_id
. The attributes
table which hold the name of each unique attribute.
The attributes
table is flexible, allowing a variable number of attributes to be stored from a variety of different other models using attributable_id
and attributable_type
fields. How do I make these fields searchable over AJAX using DT with yajra/laravel-datatables
?
For instance, I might have attributable_id=1
AND attributable_type='Product'
AND attribute_id=5
.