@@ -4,19 +4,19 @@ |
||
| 4 | 4 | |
| 5 | 5 | class BaseRepository |
| 6 | 6 | { |
| 7 | - public function selectAll() |
|
| 8 | - { |
|
| 9 | - return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get(); |
|
| 10 | - } |
|
| 7 | + public function selectAll() |
|
| 8 | + { |
|
| 9 | + return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get(); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | 12 | public function selectAllByShopId($shopId) |
| 13 | 13 | { |
| 14 | - return $this->model->where('shop_id', $shopId)->get(); |
|
| 14 | + return $this->model->where('shop_id', $shopId)->get(); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function selectAllActiveByShopId($shopId) |
| 18 | 18 | { |
| 19 | - return $this->model->where('shop_id', $shopId)->where('active', 1)->get(); |
|
| 19 | + return $this->model->where('shop_id', $shopId)->where('active', 1)->get(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getModel() { |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | function selectAllActiveByShopId($shopId) |
| 34 | 34 | { |
| 35 | - return $this->model->where('shop_id', $shopId)->get(); |
|
| 35 | + return $this->model->where('shop_id', $shopId)->get(); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -40,17 +40,17 @@ |
||
| 40 | 40 | |
| 41 | 41 | function selectAllByShopId($shopId) |
| 42 | 42 | { |
| 43 | - return $this->model->where('shop_id', $shopId)->orderBy('title', 'asc')->get(); |
|
| 43 | + return $this->model->where('shop_id', $shopId)->orderBy('title', 'asc')->get(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | function selectAllActiveByShopId($shopId) |
| 47 | 47 | { |
| 48 | - return $this->model->where('shop_id', $shopId)->where('active', 1)->orderBy('title', 'asc')->get(); |
|
| 48 | + return $this->model->where('shop_id', $shopId)->where('active', 1)->orderBy('title', 'asc')->get(); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function selectAllByShopIdAndRoot($shopId) |
| 52 | 52 | { |
| 53 | - return $this->model->roots()->where('shop_id', $shopId)->where('active', 1)->orderBy('title', 'asc')->get(); |
|
| 53 | + return $this->model->roots()->where('shop_id', $shopId)->where('active', 1)->orderBy('title', 'asc')->get(); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | function selectCategoriesByParentId($shopId, $parentId, $imageTag = false) |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | function selectAllActiveByShopId($shopId) |
| 18 | 18 | { |
| 19 | - return $this->model->where('shop_id', $shopId)->get(); |
|
| 19 | + return $this->model->where('shop_id', $shopId)->get(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | function selectOneByShopIdAndSlug($shopId, $slug) |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | function selectAllByShopId($shopId) |
| 35 | 35 | { |
| 36 | - return $this->model->where('shop_id', $shopId)->get(); |
|
| 36 | + return $this->model->where('shop_id', $shopId)->get(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function selectAllExport() |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function selectOneByShopIdAndId($shopId, $productId = false, $attributeId = false) |
| 119 | 119 | { |
| 120 | - return $this->model->with( |
|
| 121 | - array( |
|
| 120 | + return $this->model->with( |
|
| 121 | + array( |
|
| 122 | 122 | 'attributeGroup', |
| 123 | 123 | 'attributes' => function ($query) { |
| 124 | 124 | $query->with( |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | )->with(array('relatedProductAttributes', |
| 168 | 168 | 'relatedAttributes')); |
| 169 | 169 | }) |
| 170 | - )->where('shop_id', $shopId)->where('active', 1)->whereNotNull('product_category_id')->where('id', '=', $productId)->get()->first(); |
|
| 170 | + )->where('shop_id', $shopId)->where('active', 1)->whereNotNull('product_category_id')->where('id', '=', $productId)->get()->first(); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function ajaxProductImages($product, $combinationsIds, $productAttributeId = false) |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | function selectOneByShopIdAndSlug($shopId, $slug) |
| 41 | 41 | { |
| 42 | - return $this->model->with(array('productCategory', 'productImages'))->get()->first(); |
|
| 42 | + return $this->model->with(array('productCategory', 'productImages'))->get()->first(); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | function selectOneByShopIdAndId($shopId, $productAttributeId) |
| 46 | 46 | { |
| 47 | - return $this->model->with(array('productCategory', 'productImages'))->where('id', '=', $productAttributeId)->get()->first(); |
|
| 47 | + return $this->model->with(array('productCategory', 'productImages'))->where('id', '=', $productAttributeId)->get()->first(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function selectAllByProductCategoryId($productCategoryId, $shopId) |
| 69 | 69 | { |
| 70 | - return $this->model-> |
|
| 71 | - whereHas('product', function ($query) use ($productCategoryId, $shopId) { |
|
| 70 | + return $this->model-> |
|
| 71 | + whereHas('product', function ($query) use ($productCategoryId, $shopId) { |
|
| 72 | 72 | $query->where('product_category_id', '=', $productCategoryId); |
| 73 | 73 | $query->where('active', 1); |
| 74 | 74 | $query->where('shop_id', $shopId); |
| 75 | - })->with(array('combinations' => function ($q) { |
|
| 75 | + })->with(array('combinations' => function ($q) { |
|
| 76 | 76 | $q->with(array('attribute' => function ($q) { |
| 77 | 77 | $q->with(array('attributeGroup')); |
| 78 | 78 | })); |
| 79 | - }))->get(); |
|
| 79 | + }))->get(); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function increaseAmounts($products) |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | function getProductAttribute($product, $productAttributeId, $secondAttributeId = false) { |
| 117 | - $productAttribute = $this->model->where('product_id', '=', $product->id) |
|
| 117 | + $productAttribute = $this->model->where('product_id', '=', $product->id) |
|
| 118 | 118 | ->whereHas('combinations', function ($query) use ($productAttributeId, $secondAttributeId) { |
| 119 | 119 | if ($productAttributeId) { |
| 120 | 120 | $query->where('attribute_id', '=', $productAttributeId); |
@@ -30,28 +30,28 @@ |
||
| 30 | 30 | |
| 31 | 31 | function selectOneByShopIdAndSlug($shopId, $slug) |
| 32 | 32 | { |
| 33 | - return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('slug', $slug)->get()->first(); |
|
| 33 | + return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('slug', $slug)->get()->first(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | function selectOneByShopIdAndId($shopId, $id) |
| 37 | 37 | { |
| 38 | - return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('id', $id)->get()->first(); |
|
| 38 | + return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('id', $id)->get()->first(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function selectAllByProductCategoryId($productCategoryId, $shopId) |
| 42 | 42 | { |
| 43 | 43 | |
| 44 | - return $this->model-> |
|
| 45 | - whereHas('product', function ($query) use ($productCategoryId, $shopId) { |
|
| 44 | + return $this->model-> |
|
| 45 | + whereHas('product', function ($query) use ($productCategoryId, $shopId) { |
|
| 46 | 46 | $query->where('product_category_id', '=', $productCategoryId); |
| 47 | 47 | $query->where('active', 1); |
| 48 | 48 | $query->where('shop_id', $shopId); |
| 49 | - })->with( |
|
| 50 | - array( |
|
| 49 | + })->with( |
|
| 50 | + array( |
|
| 51 | 51 | 'extraFieldDefaultValue', |
| 52 | 52 | 'extraField' => function ($q) { |
| 53 | 53 | } |
| 54 | 54 | ) |
| 55 | - )->get(); |
|
| 55 | + )->get(); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | public function selectAllGroups() |
| 296 | 296 | { |
| 297 | - return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get(); |
|
| 297 | + return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get(); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | public function findGroup($groupId) |
@@ -325,12 +325,12 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | function selectAllByBlogCategoryId($newsCategoryId) |
| 327 | 327 | { |
| 328 | - return $this->model->with(array('extraFields' => function ($query) { |
|
| 329 | - }, 'taxRate', 'newsCategory', 'relatedBlogs' => function ($query) { |
|
| 328 | + return $this->model->with(array('extraFields' => function ($query) { |
|
| 329 | + }, 'taxRate', 'newsCategory', 'relatedBlogs' => function ($query) { |
|
| 330 | 330 | $query->with('newsImages')->orderBy('rank', 'asc'); |
| 331 | - }, 'newsImages' => function ($query) { |
|
| 331 | + }, 'newsImages' => function ($query) { |
|
| 332 | 332 | $query->orderBy('rank', 'asc'); |
| 333 | - }))->where('active', 1)->where('news_category_id', '=', $newsCategoryId)->get(); |
|
| 333 | + }))->where('active', 1)->where('news_category_id', '=', $newsCategoryId)->get(); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | function selectOneById($shopId, $slug) |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | function selectAllActiveGroupsByShopId($shopId) |
| 346 | 346 | { |
| 347 | - return $this->modelGroup->where('shop_id', $shopId)->where('active', 1)->get(); |
|
| 347 | + return $this->modelGroup->where('shop_id', $shopId)->where('active', 1)->get(); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | function selectOneGroupByShopIdAndSlug($shopId, $slug) |
@@ -376,9 +376,9 @@ discard block |
||
| 376 | 376 | { |
| 377 | 377 | $dt = Carbon::now('Europe/Amsterdam'); |
| 378 | 378 | |
| 379 | - $result = $this->model |
|
| 380 | - ->where('shop_id', $shopId) |
|
| 381 | - ->where('published_at', '<=', $dt->toDateString('Y-m-d')); |
|
| 379 | + $result = $this->model |
|
| 380 | + ->where('shop_id', $shopId) |
|
| 381 | + ->where('published_at', '<=', $dt->toDateString('Y-m-d')); |
|
| 382 | 382 | |
| 383 | 383 | return array( |
| 384 | 384 | 'totals' => $result->get()->count(), |
@@ -392,12 +392,12 @@ discard block |
||
| 392 | 392 | { |
| 393 | 393 | $dt = Carbon::now('Europe/Amsterdam'); |
| 394 | 394 | |
| 395 | - $result = $this->model |
|
| 396 | - ->where('shop_id', $shopId) |
|
| 397 | - ->where('published_at', '<=', $dt->toDateString('Y-m-d')) |
|
| 398 | - ->whereHas('newsGroup', function ($query) use ($newsGroupSlug) { |
|
| 395 | + $result = $this->model |
|
| 396 | + ->where('shop_id', $shopId) |
|
| 397 | + ->where('published_at', '<=', $dt->toDateString('Y-m-d')) |
|
| 398 | + ->whereHas('newsGroup', function ($query) use ($newsGroupSlug) { |
|
| 399 | 399 | $query->where('slug', '=', $newsGroupSlug); |
| 400 | - }); |
|
| 400 | + }); |
|
| 401 | 401 | |
| 402 | 402 | return array( |
| 403 | 403 | 'totals' => $result->get()->count(), |