@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | private function fireEvent($event, $tag) |
| 132 | 132 | { |
| 133 | - ! $event && $event = 'tmp_tagged'; |
|
| 133 | + !$event && $event = 'tmp_tagged'; |
|
| 134 | 134 | |
| 135 | - $event .= ':'.$this->model->getTable().','.$tag->title; |
|
| 135 | + $event .= ':' . $this->model->getTable() . ',' . $tag->title; |
|
| 136 | 136 | |
| 137 | 137 | event($event, [$this->model, $tag]); |
| 138 | 138 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | private function deleteAll($tags) |
| 153 | 153 | { |
| 154 | - $tags->each(function ($tag) { |
|
| 154 | + $tags->each(function($tag) { |
|
| 155 | 155 | $tag->delete(); |
| 156 | 156 | }); |
| 157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | private function getCacheKey($title) |
| 165 | 165 | { |
| 166 | - return 'temp_tag:'.$this->model->getTable().$this->model->getKey().','.$title; |
|
| 166 | + return 'temp_tag:' . $this->model->getTable() . $this->model->getKey() . ',' . $title; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | private function putInCache($expDate, $tagObj) |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public static function registerRelationship($q) |
| 200 | 200 | { |
| 201 | 201 | $table = $q->getModel()->getTable(); |
| 202 | - if (! in_array($table, TagService::$registeredRelation)) { |
|
| 202 | + if (!in_array($table, TagService::$registeredRelation)) { |
|
| 203 | 203 | Relation::morphMap([$table => get_class($q->getModel())]); |
| 204 | 204 | TagService::$registeredRelation[] = $table; |
| 205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | public static function whereHasClosure($relation, $method) |
| 209 | 209 | { |
| 210 | - return function ($title, $payload = []) use ($relation, $method) { |
|
| 210 | + return function($title, $payload = []) use ($relation, $method) { |
|
| 211 | 211 | TagService::registerRelationship($this); |
| 212 | 212 | |
| 213 | 213 | return $this->$method($relation, TagService::getClosure($title, $payload)); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | public static function whereHasUntilClosure($method) { |
| 218 | - return function ($title, $time, $payload = []) use ($method) { |
|
| 218 | + return function($title, $time, $payload = []) use ($method) { |
|
| 219 | 219 | TagService::registerRelationship($this); |
| 220 | 220 | |
| 221 | 221 | return $this->$method('tempTags', TagService::getClosure($title, $payload, ['>', $time])); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | public static function getClosure($title, $payload, $time = null) |
| 226 | 226 | { |
| 227 | - return function ($q) use ($title, $payload, $time) { |
|
| 227 | + return function($q) use ($title, $payload, $time) { |
|
| 228 | 228 | if (is_string($title) && Str::contains($title, ['*'])) { |
| 229 | 229 | $title = str_replace('*', '%', $title); |
| 230 | 230 | $q->where('title', 'like', $title); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | foreach ($payload as $key => $value) { |
| 236 | - $q->where('payload->'.$key, $value); |
|
| 236 | + $q->where('payload->' . $key, $value); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $time && $q->where('expired_at', $time[0], $time[1]); |