@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function bootTaggable() |
45 | 45 | { |
46 | - if(static::untagOnDelete()) { |
|
46 | + if (static::untagOnDelete()) { |
|
47 | 47 | static::deleting(function($model) { |
48 | 48 | $model->untag(); |
49 | 49 | }); |
50 | 50 | } |
51 | 51 | |
52 | - static::saved(function ($model) { |
|
52 | + static::saved(function($model) { |
|
53 | 53 | $model->autoTagPostSave(); |
54 | 54 | }); |
55 | 55 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getTagsAttribute() |
77 | 77 | { |
78 | - return $this->tagged->map(function(Tagged $item){ |
|
78 | + return $this->tagged->map(function(Tagged $item) { |
|
79 | 79 | return $item->tag; |
80 | 80 | }); |
81 | 81 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $tagNames = TaggingUtility::makeTagArray($tagNames); |
99 | 99 | |
100 | - foreach($tagNames as $tagName) { |
|
100 | + foreach ($tagNames as $tagName) { |
|
101 | 101 | $this->addSingleTag($tagName); |
102 | 102 | } |
103 | 103 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function tagNames(): array |
121 | 121 | { |
122 | - return $this->tagged->map(function($item){ |
|
122 | + return $this->tagged->map(function($item) { |
|
123 | 123 | return $item->tag_name; |
124 | 124 | })->toArray(); |
125 | 125 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function tagSlugs(): array |
133 | 133 | { |
134 | - return $this->tagged->map(function($item){ |
|
134 | + return $this->tagged->map(function($item) { |
|
135 | 135 | return $item->tag_slug; |
136 | 136 | })->toArray(); |
137 | 137 | } |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function untag($tagNames = null) |
145 | 145 | { |
146 | - if(is_null($tagNames)) { |
|
146 | + if (is_null($tagNames)) { |
|
147 | 147 | $tagNames = $this->tagNames(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | $tagNames = TaggingUtility::makeTagArray($tagNames); |
151 | 151 | |
152 | - foreach($tagNames as $tagName) { |
|
152 | + foreach ($tagNames as $tagName) { |
|
153 | 153 | $this->removeSingleTag($tagName); |
154 | 154 | } |
155 | 155 | |
156 | - if(static::shouldDeleteUnused()) { |
|
156 | + if (static::shouldDeleteUnused()) { |
|
157 | 157 | TaggingUtility::deleteUnusedTags(); |
158 | 158 | } |
159 | 159 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $this->untag($deletions); |
175 | 175 | |
176 | - foreach($additions as $tagName) { |
|
176 | + foreach ($additions as $tagName) { |
|
177 | 177 | $this->addSingleTag($tagName); |
178 | 178 | } |
179 | 179 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function scopeWithAllTags(Builder $query, $tagNames): Builder |
190 | 190 | { |
191 | - if(!is_array($tagNames)) { |
|
191 | + if (!is_array($tagNames)) { |
|
192 | 192 | $tagNames = func_get_args(); |
193 | 193 | array_shift($tagNames); |
194 | 194 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $className = $query->getModel()->getMorphClass(); |
199 | 199 | |
200 | - foreach($tagNames as $tagSlug) { |
|
200 | + foreach ($tagNames as $tagSlug) { |
|
201 | 201 | |
202 | 202 | $model = TaggingUtility::taggedModelString(); |
203 | 203 | |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | { |
254 | 254 | $tagName = trim($tagName); |
255 | 255 | |
256 | - if(strlen($tagName) == 0) { |
|
256 | + if (strlen($tagName) == 0) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
260 | 260 | $tagSlug = TaggingUtility::normalize($tagName); |
261 | 261 | |
262 | 262 | $previousCount = $this->tagged()->where('tag_slug', '=', $tagSlug)->take(1)->count(); |
263 | - if($previousCount >= 1) { return; } |
|
263 | + if ($previousCount >= 1) { return; } |
|
264 | 264 | |
265 | 265 | $model = TaggingUtility::taggedModelString(); |
266 | 266 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | $tagSlug = TaggingUtility::normalize($tagName); |
291 | 291 | |
292 | - if($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
292 | + if ($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
293 | 293 | TaggingUtility::decrementCount($tagName, $tagSlug, $count); |
294 | 294 | } |
295 | 295 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | private function assembleTagsForScoping($query, $tagNames) |
385 | 385 | { |
386 | - if(!is_array($tagNames)) { |
|
386 | + if (!is_array($tagNames)) { |
|
387 | 387 | $tagNames = func_get_args(); |
388 | 388 | array_shift($tagNames); |
389 | 389 | } |