• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

How to scope datagrids queries? they are using DB Query

Modules
2
4
158
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    moto485 last edited by 27 Dec 2024, 18:24

    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?

    1 Reply Last reply Reply Quote 0
    • Rishabh-Webkul
      Rishabh-Webkul last edited by 30 Dec 2024, 07:39

      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

      scope.png

      Thanks & Regards

      M 1 Reply Last reply 11 Jan 2025, 15:30 Reply Quote 0
      • 12 days later
      • M
        moto485 @Rishabh-Webkul last edited by 11 Jan 2025, 15:30

        @Rishabh-Webkul adding to 'filters' in the request gave me another way to look at scoping it thanks!

        1 Reply Last reply Reply Quote 0
        • Rishabh-Webkul
          Rishabh-Webkul last edited by 15 Jan 2025, 05:33

          Hello @moto485

          You're Welcome

          Also, if you like our support you can provide us with the 5 star reviews on Capterra from the link below.

          Link:

          https://reviews.capterra.com/products/new/74fc2868-0d59-4e61-8a46-bc7a1c207162/?lang=en

          Thanks & Regards

          1 Reply Last reply Reply Quote 0
          2 out of 4
          • First post
            2/4
            Last post