@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | if ($this->app->runningInConsole()) { |
| 37 | 37 | $this->publishes([ |
| 38 | - __DIR__.'/../config/temp_tag.php' => config_path('tag.php'), |
|
| 38 | + __DIR__ . '/../config/temp_tag.php' => config_path('tag.php'), |
|
| 39 | 39 | ], 'tag-config'); |
| 40 | 40 | |
| 41 | 41 | $this->publishes([ |
| 42 | - __DIR__.'/../database/migrations' => database_path('migrations'), |
|
| 42 | + __DIR__ . '/../database/migrations' => database_path('migrations'), |
|
| 43 | 43 | ], 'migrations'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | private function registerMigrations() |
| 50 | 50 | { |
| 51 | 51 | if ($this->app->runningInConsole() && $this->shouldLoadDefaultMigrations()) { |
| 52 | - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
| 52 | + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private function configure() |
| 57 | 57 | { |
| 58 | - if (! $this->app->configurationIsCached()) { |
|
| 59 | - $this->mergeConfigFrom(__DIR__.'/../config/temp_tag.php', 'tag'); |
|
| 58 | + if (!$this->app->configurationIsCached()) { |
|
| 59 | + $this->mergeConfigFrom(__DIR__ . '/../config/temp_tag.php', 'tag'); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -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) |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public static function registerRelationship($q) |
| 201 | 201 | { |
| 202 | 202 | $table = $q->getModel()->getTable(); |
| 203 | - if (! in_array($table, TagService::$registeredRelation)) { |
|
| 203 | + if (!in_array($table, TagService::$registeredRelation)) { |
|
| 204 | 204 | TagService::$registeredRelation[] = $table; |
| 205 | 205 | Relation::morphMap([$table => get_class($q->getModel())]); |
| 206 | 206 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | public static function whereHasClosure($relation, $method) |
| 210 | 210 | { |
| 211 | - return function ($title, $payload = []) use ($relation, $method) { |
|
| 211 | + return function($title, $payload = []) use ($relation, $method) { |
|
| 212 | 212 | TagService::registerRelationship($this); |
| 213 | 213 | |
| 214 | 214 | return $this->$method($relation, TagService::getClosure($title, $payload)); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | public static function getClosure($title, $payload) |
| 219 | 219 | { |
| 220 | - return function ($q) use ($title, $payload) { |
|
| 220 | + return function($q) use ($title, $payload) { |
|
| 221 | 221 | if (is_string($title) && Str::contains($title, ['*'])) { |
| 222 | 222 | $title = str_replace('*', '%', $title); |
| 223 | 223 | $q->where('title', 'like', $title); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | foreach ($payload as $key => $value) { |
| 229 | - $q->where('payload->'.$key, $value); |
|
| 229 | + $q->where('payload->' . $key, $value); |
|
| 230 | 230 | } |
| 231 | 231 | }; |
| 232 | 232 | } |