How to use searcable() method on results returned by query builder. Suppose there are five tables
- products
- vendors
- categories
- vendor_products (pivot table for Products and Vendors)
- product_categories (pivot table for Products and Categories)
Is there a way to use searchable on the following query. return \DB::table("products") ->join('vendor_products', function ($join) { $join->on('products.id', '=', 'vendor_products.product_id') ->MANY_OTHER_WHERE_CONDITIONS }) ->join('categories', function ($join) { $join->on('category_id', '=', 'categories.id'); }) ->MANY_OTHER_CONDITIONS ->searchable()
But Laraval scout return error Call to undefined method Illuminate\Database\Query\Builder::searchable()
Is there a way to upload the results of above query. I have added searcable trait on vendors, categories, and products models.
It looks like Scout only work when we have Eloquent relationship returned from the query and don't work on query builder.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire