@@ -29,7 +29,7 @@ |
||
29 | 29 | ); |
30 | 30 | |
31 | 31 | if ($id) { |
32 | - $rules['name'] = 'required|between:4,65|unique_with:general_setting, shop_id, '.$id.' = id'; |
|
32 | + $rules['name'] = 'required|between:4,65|unique_with:general_setting, shop_id, '.$id.' = id'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $rules; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $instance = new static; |
21 | 21 | |
22 | - $query = $instance->where($saveTo, 'LIKE', $slug . '%'); |
|
22 | + $query = $instance->where($saveTo, 'LIKE', $slug.'%'); |
|
23 | 23 | |
24 | 24 | // @overriden - changed this to scope unique slugs per user |
25 | 25 | $query = $query->where('shop_id', $this->shop_id); |
@@ -9,17 +9,17 @@ |
||
9 | 9 | |
10 | 10 | class GeneralSettingService extends BaseService |
11 | 11 | { |
12 | - public function __construct(GeneralSettingRepository $generalSetting) |
|
13 | - { |
|
14 | - $this->repo = $generalSetting; |
|
15 | - } |
|
16 | - |
|
17 | - /** |
|
18 | - * The validation rules for the model. |
|
19 | - * |
|
20 | - * @param integer $settingId id attribute model |
|
21 | - * @return array |
|
22 | - */ |
|
12 | + public function __construct(GeneralSettingRepository $generalSetting) |
|
13 | + { |
|
14 | + $this->repo = $generalSetting; |
|
15 | + } |
|
16 | + |
|
17 | + /** |
|
18 | + * The validation rules for the model. |
|
19 | + * |
|
20 | + * @param integer $settingId id attribute model |
|
21 | + * @return array |
|
22 | + */ |
|
23 | 23 | public function rules($settingId = false) |
24 | 24 | { |
25 | 25 | $rules = array( |
@@ -28,7 +28,7 @@ |
||
28 | 28 | ); |
29 | 29 | |
30 | 30 | if ($settingId) { |
31 | - $rules['name'] = $rules['name'].','.$settingId.' = id'; |
|
31 | + $rules['name'] = $rules['name'].','.$settingId.' = id'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $rules; |
@@ -13,5 +13,5 @@ |
||
13 | 13 | */ |
14 | 14 | protected $table = 'general_setting'; |
15 | 15 | |
16 | - protected $fillable = ['id', 'name', 'value', 'text_value', 'shop_id']; |
|
16 | + protected $fillable = ['id', 'name', 'value', 'text_value', 'shop_id']; |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -9,10 +9,10 @@ |
||
9 | 9 | |
10 | 10 | class CouponService extends BaseService |
11 | 11 | { |
12 | - public function __construct(CouponRepository $coupon) |
|
13 | - { |
|
14 | - $this->repo = $coupon; |
|
15 | - } |
|
12 | + public function __construct(CouponRepository $coupon) |
|
13 | + { |
|
14 | + $this->repo = $coupon; |
|
15 | + } |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | ); |
32 | 32 | |
33 | 33 | if ($couponId) { |
34 | - $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$couponId.' = id'; |
|
35 | - $rules['code'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$couponId.' = id'; |
|
34 | + $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$couponId.' = id'; |
|
35 | + $rules['code'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$couponId.' = id'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return $rules; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | if ($groupId) { |
49 | - $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getGroupModel()->getTable().', shop_id, '.$groupId.' = id'; |
|
49 | + $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getGroupModel()->getTable().', shop_id, '.$groupId.' = id'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | return $rules; |
39 | 39 | } |
40 | 40 | |
41 | - public function __construct(ProductCategoryRepository $productCategory) |
|
42 | - { |
|
43 | - $this->repo = $productCategory; |
|
41 | + public function __construct(ProductCategoryRepository $productCategory) |
|
42 | + { |
|
43 | + $this->repo = $productCategory; |
|
44 | 44 | $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/product_category/"; |
45 | 45 | $this->publicImagePath = public_path() .config('hideyo.public_path'). "/product_category/"; |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | public function create(array $attributes) |
49 | 49 | { |
@@ -286,22 +286,22 @@ discard block |
||
286 | 286 | |
287 | 287 | public function selectOneByShopIdAndSlug($shopId, $slug, $imageTag = false) |
288 | 288 | { |
289 | - return $this->repo->selectOneByShopIdAndSlug($shopId, $slug, $imageTag); |
|
289 | + return $this->repo->selectOneByShopIdAndSlug($shopId, $slug, $imageTag); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | public function selectAllByShopIdAndRoot($shopId) |
293 | 293 | { |
294 | - return $this->repo->selectAllByShopIdAndRoot($shopId); |
|
294 | + return $this->repo->selectAllByShopIdAndRoot($shopId); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | public function selectRootCategories($shopId, $imageTag) |
298 | 298 | { |
299 | - return $this->repo->selectRootCategories($shopId, $imageTag); |
|
299 | + return $this->repo->selectRootCategories($shopId, $imageTag); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | public function selectCategoriesByParentId($shopId, $parentId, $imageTag = false) |
303 | 303 | { |
304 | - return $this->repo->selectCategoriesByParentId($shopId, $parentId, $imageTag); |
|
304 | + return $this->repo->selectCategoriesByParentId($shopId, $parentId, $imageTag); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | public function selectAllProductPullDown() |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ); |
33 | 33 | |
34 | 34 | if ($productCategoryId) { |
35 | - $rules['title'] = 'required|between:4,65|unique_with:'.'product_category, shop_id, '.$productCategoryId.' = id'; |
|
35 | + $rules['title'] = 'required|between:4,65|unique_with:'.'product_category, shop_id, '.$productCategoryId.' = id'; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | return $rules; |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | public function __construct(ProductCategoryRepository $productCategory) |
42 | 42 | { |
43 | 43 | $this->repo = $productCategory; |
44 | - $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/product_category/"; |
|
45 | - $this->publicImagePath = public_path() .config('hideyo.public_path'). "/product_category/"; |
|
44 | + $this->storageImagePath = storage_path().config('hideyo.storage_path')."/product_category/"; |
|
45 | + $this->publicImagePath = public_path().config('hideyo.public_path')."/product_category/"; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function create(array $attributes) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($validator->fails()) { |
149 | 149 | return $validator; |
150 | 150 | } else { |
151 | - $filename = str_replace(" ", "_", strtolower($attributes['file']->getClientOriginalName())); |
|
151 | + $filename = str_replace(" ", "_", strtolower($attributes['file']->getClientOriginalName())); |
|
152 | 152 | $uploadSuccess = $attributes['file']->move($destinationPath, $filename); |
153 | 153 | |
154 | 154 | if ($uploadSuccess) { |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - $directory = storage_path() . "/app/files/product_category/".$this->model->id; |
|
245 | + $directory = storage_path()."/app/files/product_category/".$this->model->id; |
|
246 | 246 | File::deleteDirectory($directory); |
247 | - File::deleteDirectory(public_path() . "/files/product_category/".$this->model->id); |
|
247 | + File::deleteDirectory(public_path()."/files/product_category/".$this->model->id); |
|
248 | 248 | |
249 | 249 | if ($this->model->children()->count()) { |
250 | 250 | foreach ($this->model->children()->get() as $child) { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function destroyImage($imageId) |
261 | 261 | { |
262 | 262 | $this->imageModel = $this->findImage($imageId); |
263 | - $filename = storage_path() ."/app/files/product_category/".$this->imageModel->product_category_id."/".$this->imageModel->file; |
|
263 | + $filename = storage_path()."/app/files/product_category/".$this->imageModel->product_category_id."/".$this->imageModel->file; |
|
264 | 264 | $shopId = auth('hideyobackend')->user()->selected_shop_id; |
265 | 265 | $shop = ShopService::find($shopId); |
266 | 266 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $sizes = explode(',', $shop->thumbnail_square_sizes); |
271 | 271 | if ($sizes) { |
272 | 272 | foreach ($sizes as $key => $value) { |
273 | - File::delete(public_path() . "/files/product_category/".$value."/".$this->imageModel->product_category_id."/".$this->imageModel->file); |
|
273 | + File::delete(public_path()."/files/product_category/".$value."/".$this->imageModel->product_category_id."/".$this->imageModel->file); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | */ |
14 | 14 | protected $table = 'product_category_image'; |
15 | 15 | |
16 | - protected $guarded = array('file'); |
|
16 | + protected $guarded = array('file'); |
|
17 | 17 | |
18 | 18 | // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model. |
19 | - protected $fillable = ['product_category_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',]; |
|
19 | + protected $fillable = ['product_category_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ]; |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | return [ |
27 | 27 | 'slug' => [ |
28 | 28 | 'source' => 'title', |
29 | - 'onUpdate' => true |
|
29 | + 'onUpdate' => true |
|
30 | 30 | ] |
31 | 31 | ]; |
32 | 32 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | parent::boot(); |
42 | 42 | |
43 | 43 | static::moving(function ($node) { |
44 | - // YOUR CODE HERE |
|
44 | + // YOUR CODE HERE |
|
45 | 45 | }); |
46 | 46 | |
47 | 47 | static::moved(function ($node) { |
48 | - // YOUR CODE HERE |
|
48 | + // YOUR CODE HERE |
|
49 | 49 | }); |
50 | 50 | } |
51 | 51 |
@@ -40,11 +40,11 @@ |
||
40 | 40 | { |
41 | 41 | parent::boot(); |
42 | 42 | |
43 | - static::moving(function ($node) { |
|
43 | + static::moving(function($node) { |
|
44 | 44 | // YOUR CODE HERE |
45 | 45 | }); |
46 | 46 | |
47 | - static::moved(function ($node) { |
|
47 | + static::moved(function($node) { |
|
48 | 48 | // YOUR CODE HERE |
49 | 49 | }); |
50 | 50 | } |
@@ -44,17 +44,17 @@ |
||
44 | 44 | |
45 | 45 | function selectAllByShopId($shopId) |
46 | 46 | { |
47 | - return $this->model->where('shop_id', '=', $shopId)->orderBy('title', 'asc')->get(); |
|
47 | + return $this->model->where('shop_id', '=', $shopId)->orderBy('title', 'asc')->get(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | function selectAllActiveByShopId($shopId) |
51 | 51 | { |
52 | - return $this->model->where('shop_id', '=', $shopId)->where('active', '=', 1)->orderBy('title', 'asc')->get(); |
|
52 | + return $this->model->where('shop_id', '=', $shopId)->where('active', '=', 1)->orderBy('title', 'asc')->get(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | function selectAllByShopIdAndRoot($shopId) |
56 | 56 | { |
57 | - return $this->model->roots()->where('shop_id', '=', $shopId)->where('active', '=', 1)->orderBy('title', 'asc')->get(); |
|
57 | + return $this->model->roots()->where('shop_id', '=', $shopId)->where('active', '=', 1)->orderBy('title', 'asc')->get(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | function selectCategoriesByParentId($shopId, $parentId, $imageTag = false) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->model->where('id', '=', $parentId)->first()->children() |
63 | 63 | ->with( |
64 | - array('productCategoryImages' => function ($query) use ($imageTag) { |
|
64 | + array('productCategoryImages' => function($query) use ($imageTag) { |
|
65 | 65 | if ($imageTag) { |
66 | 66 | $query->where('tag', '=', $imageTag); |
67 | 67 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $result = $this->model |
86 | 86 | ->with( |
87 | - array('productCategoryImages' => function ($query) use ($imageTag) { |
|
87 | + array('productCategoryImages' => function($query) use ($imageTag) { |
|
88 | 88 | if ($imageTag) { |
89 | 89 | $query->where('tag', '=', $imageTag); |
90 | 90 | } |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | $result = $this->model-> |
124 | 124 | with( |
125 | 125 | array( |
126 | - 'products' => function ($query) { |
|
126 | + 'products' => function($query) { |
|
127 | 127 | $query->where('active', '=', 1)->with( |
128 | - array('productImages' => function ($query) { |
|
128 | + array('productImages' => function($query) { |
|
129 | 129 | $query->orderBy('rank', 'asc'); |
130 | 130 | }) |
131 | 131 | ); |
132 | 132 | }, |
133 | - 'productCategoryImages' => function ($query) use ($imageTag) { |
|
133 | + 'productCategoryImages' => function($query) use ($imageTag) { |
|
134 | 134 | if ($imageTag) { |
135 | 135 | $query->where('tag', '=', $imageTag); |
136 | 136 | } $query->orderBy('rank', 'asc'); |