@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Create meta. |
19 | 19 | * |
20 | - * @param $metaable |
|
20 | + * @param HasMeta $metaable |
|
21 | 21 | * @param $key |
22 | 22 | * @param $value |
23 | 23 | * @param $group |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Remove by id. |
53 | 53 | * |
54 | - * @param $id |
|
54 | + * @param integer $id |
|
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | 57 | public function removeById($id) |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'metaable_type' => get_class($metaable), |
32 | 32 | 'key' => $key, |
33 | 33 | 'value' => $value, |
34 | - 'group' => (! is_null($group)) ? $group : 'other' |
|
34 | + 'group' => (!is_null($group)) ? $group : 'other' |
|
35 | 35 | ]); |
36 | 36 | } |
37 | 37 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | /** |
60 | 60 | * Fields for unset. |
61 | 61 | * |
62 | - * @return array |
|
62 | + * @return string[] |
|
63 | 63 | */ |
64 | 64 | public function getUnsetFields() |
65 | 65 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $image = Request::file('image'); |
49 | 49 | |
50 | - if($image) |
|
50 | + if ($image) |
|
51 | 51 | if ($image instanceof UploadedFile) { |
52 | 52 | $this->removePreviousImage($category); |
53 | 53 | $location = 'upload/categories/'; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $images = $category->images; // Incoming array of images |
80 | 80 | //, but for categories can exists only one image |
81 | 81 | |
82 | - if(count($images)) |
|
83 | - $images->each(function(Image $image){ |
|
82 | + if (count($images)) |
|
83 | + $images->each(function(Image $image) { |
|
84 | 84 | $image->delete(); |
85 | 85 | // remove image. |
86 | 86 | // @events: deleted(); remove file |
@@ -47,9 +47,10 @@ discard block |
||
47 | 47 | { |
48 | 48 | $image = Request::file('image'); |
49 | 49 | |
50 | - if($image) |
|
51 | - if ($image instanceof UploadedFile) { |
|
50 | + if($image) { |
|
51 | + if ($image instanceof UploadedFile) { |
|
52 | 52 | $this->removePreviousImage($category); |
53 | + } |
|
53 | 54 | $location = 'upload/categories/'; |
54 | 55 | $processor = new ImageProcessor(); |
55 | 56 | $processor->uploadAndCreate($image, $category, null, $location); |
@@ -79,9 +80,10 @@ discard block |
||
79 | 80 | $images = $category->images; // Incoming array of images |
80 | 81 | //, but for categories can exists only one image |
81 | 82 | |
82 | - if(count($images)) |
|
83 | - $images->each(function(Image $image){ |
|
83 | + if(count($images)) { |
|
84 | + $images->each(function(Image $image){ |
|
84 | 85 | $image->delete(); |
86 | + } |
|
85 | 87 | // remove image. |
86 | 88 | // @events: deleted(); remove file |
87 | 89 | }); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | /** |
63 | 63 | * Fields for unset. |
64 | 64 | * |
65 | - * @return array |
|
65 | + * @return string[] |
|
66 | 66 | */ |
67 | 67 | public function getUnsetFields() |
68 | 68 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $image = Request::file('image'); |
49 | 49 | |
50 | - if($image) { |
|
50 | + if ($image) { |
|
51 | 51 | if ($image instanceof UploadedFile) { |
52 | 52 | $this->removePreviousImage($category); |
53 | 53 | $location = 'upload/categories/'; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $images = $category->images; // Incoming array of images |
83 | 83 | //, but for categories can exists only one image |
84 | 84 | |
85 | - if(count($images)) |
|
86 | - $images->each(function(Image $image){ |
|
85 | + if (count($images)) |
|
86 | + $images->each(function(Image $image) { |
|
87 | 87 | $image->delete(); |
88 | 88 | // remove image. |
89 | 89 | // @events: deleted(); remove file |
@@ -82,9 +82,10 @@ |
||
82 | 82 | $images = $category->images; // Incoming array of images |
83 | 83 | //, but for categories can exists only one image |
84 | 84 | |
85 | - if(count($images)) |
|
86 | - $images->each(function(Image $image){ |
|
85 | + if(count($images)) { |
|
86 | + $images->each(function(Image $image){ |
|
87 | 87 | $image->delete(); |
88 | + } |
|
88 | 89 | // remove image. |
89 | 90 | // @events: deleted(); remove file |
90 | 91 | }); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Listeners\Observers; |
4 | 4 | |
5 | 5 | use App\Repositories\TaggableSubCategoriesRepository; |
6 | -use App\TaggableSubCategory; |
|
7 | 6 | use Request; |
8 | 7 | use Cviebrock\EloquentTaggable\Services\TagService; |
9 | 8 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | /** |
54 | 54 | * Fields for unset. |
55 | 55 | * |
56 | - * @return array |
|
56 | + * @return string[] |
|
57 | 57 | */ |
58 | 58 | public function getUnsetFields() |
59 | 59 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $image = Request::file('image'); |
40 | 40 | |
41 | - if($image) { |
|
41 | + if ($image) { |
|
42 | 42 | if ($image instanceof UploadedFile) { |
43 | 43 | $this->removePreviousImage($vendor); |
44 | 44 | $location = 'upload/vendors/'.$vendor->id; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | $images = $vendor->images; // Incoming array of images |
74 | 74 | //, but for categories can exists only one image |
75 | 75 | |
76 | - if(count($images)) |
|
77 | - $images->each(function(Image $image){ |
|
76 | + if (count($images)) |
|
77 | + $images->each(function(Image $image) { |
|
78 | 78 | $image->delete(); |
79 | 79 | // remove image. |
80 | 80 | // @events: deleted(); remove file |
@@ -73,9 +73,10 @@ |
||
73 | 73 | $images = $vendor->images; // Incoming array of images |
74 | 74 | //, but for categories can exists only one image |
75 | 75 | |
76 | - if(count($images)) |
|
77 | - $images->each(function(Image $image){ |
|
76 | + if(count($images)) { |
|
77 | + $images->each(function(Image $image){ |
|
78 | 78 | $image->delete(); |
79 | + } |
|
79 | 80 | // remove image. |
80 | 81 | // @events: deleted(); remove file |
81 | 82 | }); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Check if post was viewed user. |
58 | 58 | * |
59 | - * @param $post |
|
59 | + * @param \App\Post $post |
|
60 | 60 | * @return bool |
61 | 61 | */ |
62 | 62 | private function isPostViewed($post) |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Push item to session as viewed post. |
71 | 71 | * |
72 | - * @param $post |
|
72 | + * @param \App\Post $post |
|
73 | 73 | * @return void. |
74 | 74 | */ |
75 | 75 | private function storePost($post) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $post = $event->getPost(); |
45 | 45 | |
46 | - if ( ! $this->isPostViewed($post)) |
|
46 | + if (!$this->isPostViewed($post)) |
|
47 | 47 | { |
48 | 48 | $this->posts->incrementViewCount($post); |
49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function isPostViewed($post) |
63 | 63 | { |
64 | - $viewed = $this->session->get('viewed_posts', []); |
|
64 | + $viewed = $this->session->get('viewed_posts', [ ]); |
|
65 | 65 | |
66 | 66 | return array_key_exists($post->id, $viewed); |
67 | 67 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function storePost($post) |
76 | 76 | { |
77 | - $key = 'viewed_posts.' . $post->id; |
|
77 | + $key = 'viewed_posts.'.$post->id; |
|
78 | 78 | |
79 | 79 | $this->session->put($key, time()); |
80 | 80 | } |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use App\Http\ViewComposers\SocialComposer; |
15 | 15 | use App\Http\ViewComposers\MainComposer; |
16 | 16 | use App\Http\ViewComposers\CurrencyComposer; |
17 | - |
|
18 | 17 | use Illuminate\Support\ServiceProvider; |
19 | 18 | |
20 | 19 | class ComposerServiceProvider extends ServiceProvider |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | view()->composer('partials.banners.*', BannerComposer::class); |
34 | 34 | |
35 | - view()->composer(['partials.categories.*', 'product.partials.*'], CategoryComposer::class); |
|
35 | + view()->composer([ 'partials.categories.*', 'product.partials.*' ], CategoryComposer::class); |
|
36 | 36 | |
37 | 37 | view()->composer('partials.header.language-bar', LanguageComposer::class); |
38 | 38 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | view()->composer([ 'lots.create', 'lots.partials.form.product' ], AddLotComposer::class); |
52 | 52 | |
53 | - view()->composer('*', function($view){ |
|
53 | + view()->composer('*', function($view) { |
|
54 | 54 | return $view->with('meta', (new \App\Translate)); |
55 | 55 | }); |
56 | 56 | view()->composer( |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Repositories; |
4 | 4 | |
5 | 5 | use App\Category; |
6 | -use App\Libraries\Categoryable\Categoryable; |
|
7 | 6 | |
8 | 7 | class CategoryRepository extends Repository |
9 | 8 | { |
@@ -46,11 +46,11 @@ |
||
46 | 46 | */ |
47 | 47 | public function getSidebarCollection() |
48 | 48 | { |
49 | - return self::getModel() |
|
50 | - ->where('show_in_sidebar', 1) |
|
51 | - ->active() |
|
52 | - ->ranked() |
|
53 | - ->get(); |
|
49 | + return self::getModel() |
|
50 | + ->where('show_in_sidebar', 1) |
|
51 | + ->active() |
|
52 | + ->ranked() |
|
53 | + ->get(); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param $product_id |
19 | - * @return static |
|
19 | + * @return ImprovedSpec |
|
20 | 20 | */ |
21 | 21 | public function createPlain($product_id, $spec_id = null) |
22 | 22 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param $spec |
70 | 70 | * @param array $data |
71 | - * @return mixed |
|
71 | + * @return ImprovedSpec |
|
72 | 72 | */ |
73 | 73 | public function create(array $data, $specPrice) |
74 | 74 | { |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function createPlain($product_id, $spec_id = null) |
22 | 22 | { |
23 | - $insert = array('product_id' => (int)$product_id); |
|
23 | + $insert = array('product_id' => (int) $product_id); |
|
24 | 24 | if ($spec_id != null) { |
25 | - $insert['price_spec_id'] = (int)$spec_id; |
|
25 | + $insert[ 'price_spec_id' ] = (int) $spec_id; |
|
26 | 26 | } |
27 | 27 | return self::getModel() |
28 | 28 | ->create($insert); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function getById($id) { |
61 | 61 | return $this->getModel() |
62 | - ->where('price_spec_id',(int)$id) |
|
62 | + ->where('price_spec_id', (int) $id) |
|
63 | 63 | ->get(); |
64 | 64 | } |
65 | 65 | |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | ->create([ |
77 | 77 | 'product_id' => $specPrice->product_id, |
78 | 78 | 'price_spec_id' => $specPrice->id, |
79 | - 'size' => (isset($data['size'])) ? $data['size'] : null |
|
79 | + 'size' => (isset($data[ 'size' ])) ? $data[ 'size' ] : null |
|
80 | 80 | ]); |
81 | 81 | } |
82 | 82 | |
83 | 83 | public function save(array $data, $specPrice) |
84 | 84 | { |
85 | - $key = ((isset($data['key']) && $data['key'] != null) ? $data['key'] : null); |
|
85 | + $key = ((isset($data[ 'key' ]) && $data[ 'key' ] != null) ? $data[ 'key' ] : null); |
|
86 | 86 | $size = self::getModel()->firstOrNew(array('key'=>$key)); |
87 | 87 | $size->product_id = $specPrice->product_id; |
88 | 88 | $size->price_spec_id = $specPrice->id; |
89 | - $size->size = (isset($data['size'])) ? $data['size'] : ''; |
|
90 | - $size->key = (isset($data['key']) ? $data['key'] : ''); |
|
89 | + $size->size = (isset($data[ 'size' ])) ? $data[ 'size' ] : ''; |
|
90 | + $size->key = (isset($data[ 'key' ]) ? $data[ 'key' ] : ''); |
|
91 | 91 | $size->save(); |
92 | 92 | return $size; |
93 | 93 | } |
94 | 94 | public function update($spec, array $data) |
95 | 95 | { |
96 | 96 | $spec->fill([ |
97 | - 'size' => isset($data['size']) ? $data['size'] : null, |
|
98 | - 'color_hash' => isset($data['color']) ? $data['color'] : null, |
|
99 | - 'amount' => isset($data['sold']) ? $data['sold'] : null |
|
97 | + 'size' => isset($data[ 'size' ]) ? $data[ 'size' ] : null, |
|
98 | + 'color_hash' => isset($data[ 'color' ]) ? $data[ 'color' ] : null, |
|
99 | + 'amount' => isset($data[ 'sold' ]) ? $data[ 'sold' ] : null |
|
100 | 100 | ]); |
101 | 101 | |
102 | 102 | $spec->save(); |