How to scope datagrids queries? they are using DB Query
-
Hi, I have just started looking at Bagisto and it looks great. I am scoping all required tables with team_id.
I have made a package and made use of Concord Proxies to add a global scope check on particular models (seems to be the way to handle this) great for Eloquent.
Is there a way to go about adding this scope to the databtables? that are using the "$queryBuilder = DB::table('product_flat')...."
I can overwright for instance Webkul\Admin\DataGrids\Catalog\ProductDataGrid public function prepareQueryBuilder() and copy and paste everything in the method and add my where query but this is not a great option.
Any preferable ways to go about this? -
Hello @moto485
Firstly, if you are making any changes in the query builder then you need to override the class
Also we have used scope you can check the below image for the reference
Thanks & Regards
-
@Rishabh-Webkul adding to 'filters' in the request gave me another way to look at scoping it thanks!