dimanche 27 octobre 2019

create index for following LARAVEL eloquent query

Hi please help me out for creating an index for the following query

                        $products = \App\items::with([
                 'item_store' => function ($query) {
                $query->select('size', 'item_id', 'item_store_id');
              },

            'pics' => function ($query) {
                $query->select('img_url', 'item_id');
            },

            'brand' => function ($query) {
                $query->select('item_id', 'brand_id');
            },
            'brand.brand' => function ($query) {
                $query->select('brand_id', 'brand_name');
            }

             ])
         ->select('item_id', 'short_name', 'price','price_above')
         ->orderBy('Price', 'Asc')->whereIn('category_id', $arr)
         ->groupBy('Sku')
         ->paginate(20);

my database structure is [st] https://screenshots.firefox.com/JAmaKENMYRhQkEjx/ourweds.com



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire