@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | 'rating' => 'required|numeric' |
17 | 17 | ]; |
18 | 18 | |
19 | - public $categoryNameCache = []; |
|
19 | + public $categoryNameCache = [ ]; |
|
20 | 20 | |
21 | - public $categoryIdCache = []; |
|
21 | + public $categoryIdCache = [ ]; |
|
22 | 22 | |
23 | 23 | public function importData($results, $sessionKey = null) |
24 | 24 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $reviewExists = $review->exists; |
43 | 43 | |
44 | - $except = ['id', 'category_names', 'category_ids','approved', 'created_at']; |
|
44 | + $except = [ 'id', 'category_names', 'category_ids', 'approved', 'created_at' ]; |
|
45 | 45 | |
46 | 46 | foreach (array_except($data, $except) as $attribute => $value) { |
47 | 47 | |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | { |
88 | 88 | $categoryIds = $this->decodeArrayValue(array_get($data, 'category_ids')); |
89 | 89 | |
90 | - $ids = []; |
|
90 | + $ids = [ ]; |
|
91 | 91 | |
92 | 92 | foreach ($categoryIds as $id) { |
93 | 93 | if (!$id = trim($id)) { |
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | |
97 | - if (isset($this->categoryIdCache[$id])) { |
|
98 | - $ids[] = $this->categoryIdCache[$id]; |
|
97 | + if (isset($this->categoryIdCache[ $id ])) { |
|
98 | + $ids[ ] = $this->categoryIdCache[ $id ]; |
|
99 | 99 | } else { |
100 | 100 | $category = CategoryModel::find($id); |
101 | - if($category) { |
|
102 | - $ids[] = $this->categoryIdCache[$id] = $category->id; |
|
101 | + if ($category) { |
|
102 | + $ids[ ] = $this->categoryIdCache[ $id ] = $category->id; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | { |
112 | 112 | $categoryNames = $this->decodeArrayValue(array_get($data, 'category_names')); |
113 | 113 | |
114 | - $ids = []; |
|
114 | + $ids = [ ]; |
|
115 | 115 | |
116 | 116 | foreach ($categoryNames as $name) { |
117 | 117 | if (!$name = trim($name)) { |
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | |
121 | - if (isset($this->categoryNameCache[$name])) { |
|
122 | - $ids[] = $this->categoryNameCache[$name]; |
|
121 | + if (isset($this->categoryNameCache[ $name ])) { |
|
122 | + $ids[ ] = $this->categoryNameCache[ $name ]; |
|
123 | 123 | } else { |
124 | 124 | $category = CategoryModel::where('name', $name)->first(); |
125 | - if($category) { |
|
126 | - $ids[] = $this->categoryNameCache[$name] = $category->id; |
|
125 | + if ($category) { |
|
126 | + $ids[ ] = $this->categoryNameCache[ $name ] = $category->id; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $category->{$attribute} = $value ?: null; |
48 | 48 | } |
49 | 49 | |
50 | - $category->enabled = !!array_get($data,'enabled'); |
|
50 | + $category->enabled = !!array_get($data, 'enabled'); |
|
51 | 51 | |
52 | 52 | $category->save(); |
53 | 53 |