@@ -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 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getTagsAttribute() |
| 76 | 76 | { |
| 77 | - return $this->tagged->map(function(Tagged $item){ |
|
| 77 | + return $this->tagged->map(function(Tagged $item) { |
|
| 78 | 78 | return $item->tag; |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $tagNames = TaggingUtility::makeTagArray($tagNames); |
| 98 | 98 | |
| 99 | - foreach($tagNames as $tagName) { |
|
| 99 | + foreach ($tagNames as $tagName) { |
|
| 100 | 100 | $this->addTag($tagName); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function tagNames(): array |
| 110 | 110 | { |
| 111 | - return $this->tagged->map(function($item){ |
|
| 111 | + return $this->tagged->map(function($item) { |
|
| 112 | 112 | return $item->tag_name; |
| 113 | 113 | })->toArray(); |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function tagSlugs(): array |
| 122 | 122 | { |
| 123 | - return $this->tagged->map(function($item){ |
|
| 123 | + return $this->tagged->map(function($item) { |
|
| 124 | 124 | return $item->tag_slug; |
| 125 | 125 | })->toArray(); |
| 126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function untag($tagNames = null) |
| 134 | 134 | { |
| 135 | - if(is_null($tagNames)) { |
|
| 135 | + if (is_null($tagNames)) { |
|
| 136 | 136 | $tagNames = $this->tagNames(); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | dump($tagNames); |
| 142 | 142 | |
| 143 | - foreach($tagNames as $tagName) { |
|
| 143 | + foreach ($tagNames as $tagName) { |
|
| 144 | 144 | $this->removeSingleTag($tagName); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if(static::shouldDeleteUnused()) { |
|
| 147 | + if (static::shouldDeleteUnused()) { |
|
| 148 | 148 | TaggingUtility::deleteUnusedTags(); |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $this->untag($deletions); |
| 166 | 166 | |
| 167 | - foreach($additions as $tagName) { |
|
| 167 | + foreach ($additions as $tagName) { |
|
| 168 | 168 | $this->addTag($tagName); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function scopeWithAllTags(Builder $query, $tagNames): Builder |
| 180 | 180 | { |
| 181 | - if(!is_array($tagNames)) { |
|
| 181 | + if (!is_array($tagNames)) { |
|
| 182 | 182 | $tagNames = func_get_args(); |
| 183 | 183 | array_shift($tagNames); |
| 184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $className = $query->getModel()->getMorphClass(); |
| 189 | 189 | |
| 190 | - foreach($tagNames as $tagSlug) { |
|
| 190 | + foreach ($tagNames as $tagSlug) { |
|
| 191 | 191 | $tags = Tagged::query() |
| 192 | 192 | ->where('tag_slug', TaggingUtility::normalize($tagSlug)) |
| 193 | 193 | ->where('taggable_type', $className) |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | $tagName = trim($tagName); |
| 240 | 240 | |
| 241 | - if(strlen($tagName) == 0) { |
|
| 241 | + if (strlen($tagName) == 0) { |
|
| 242 | 242 | return; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $tagSlug = TaggingUtility::normalize($tagName); |
| 246 | 246 | |
| 247 | 247 | $previousCount = $this->tagged()->where('tag_slug', '=', $tagSlug)->take(1)->count(); |
| 248 | - if($previousCount >= 1) { return; } |
|
| 248 | + if ($previousCount >= 1) { return; } |
|
| 249 | 249 | |
| 250 | 250 | $tagged = new Tagged([ |
| 251 | 251 | 'tag_name' => TaggingUtility::displayize($tagName), |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $tagSlug = TaggingUtility::normalize($tagName); |
| 274 | 274 | |
| 275 | - if($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
| 275 | + if ($count = $this->tagged()->where('tag_slug', '=', $tagSlug)->delete()) { |
|
| 276 | 276 | TaggingUtility::decrementCount($tagName, $tagSlug, $count); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | private function assembleTagsForScoping($query, $tagNames) |
| 364 | 364 | { |
| 365 | - if(!is_array($tagNames)) { |
|
| 365 | + if (!is_array($tagNames)) { |
|
| 366 | 366 | $tagNames = func_get_args(); |
| 367 | 367 | array_shift($tagNames); |
| 368 | 368 | } |