@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function all($columns = ['*']) : Collection |
| 8 | 8 | { |
| 9 | - if (! $this->isCachable()) { |
|
| 9 | + if (!$this->isCachable()) { |
|
| 10 | 10 | $this->model->disableModelCaching(); |
| 11 | 11 | } |
| 12 | 12 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | $option = $this->option('model'); |
| 14 | 14 | |
| 15 | - if (! $option) { |
|
| 15 | + if (!$option) { |
|
| 16 | 16 | return $this->flushEntireCache(); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $usesCachableTrait = $this->getAllTraitsUsedByClass($option) |
| 37 | 37 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
| 38 | 38 | |
| 39 | - if (! $usesCachableTrait) { |
|
| 39 | + if (!$usesCachableTrait) { |
|
| 40 | 40 | $this->error("'{$option}' is not an instance of CachedModel."); |
| 41 | 41 | $this->line("Only CachedModel instances can be flushed."); |
| 42 | 42 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $tags = collect($this->eagerLoad) |
| 30 | 30 | ->keys() |
| 31 | - ->map(function ($relationName) { |
|
| 31 | + ->map(function($relationName) { |
|
| 32 | 32 | $relation = $this->getRelation($relationName); |
| 33 | 33 | |
| 34 | 34 | return $this->getCachePrefix() |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | protected function getRelation(string $relationName) : Relation |
| 54 | 54 | { |
| 55 | 55 | return collect(explode('.', $relationName)) |
| 56 | - ->reduce(function ($carry, $name) { |
|
| 56 | + ->reduce(function($carry, $name) { |
|
| 57 | 57 | $carry = $carry ?: $this->model; |
| 58 | 58 | $carry = $this->getRelatedModel($carry); |
| 59 | 59 | |
@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | $key = $instance->makeCacheKey(); |
| 23 | 23 | |
| 24 | 24 | return $instance->cache($tags) |
| 25 | - ->rememberForever($key, function () use ($columns) { |
|
| 25 | + ->rememberForever($key, function() use ($columns) { |
|
| 26 | 26 | return parent::all($columns); |
| 27 | 27 | }); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function bootCachable() |
| 31 | 31 | { |
| 32 | - static::created(function ($instance) { |
|
| 32 | + static::created(function($instance) { |
|
| 33 | 33 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - static::deleted(function ($instance) { |
|
| 36 | + static::deleted(function($instance) { |
|
| 37 | 37 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - static::saved(function ($instance) { |
|
| 40 | + static::saved(function($instance) { |
|
| 41 | 41 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 47 | 47 | // }); |
| 48 | 48 | |
| 49 | - static::pivotAttached(function ($instance, $secondInstance, $relationship) { |
|
| 49 | + static::pivotAttached(function($instance, $secondInstance, $relationship) { |
|
| 50 | 50 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | - static::pivotDetached(function ($instance, $secondInstance, $relationship) { |
|
| 53 | + static::pivotDetached(function($instance, $secondInstance, $relationship) { |
|
| 54 | 54 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - static::pivotUpdated(function ($instance, $secondInstance, $relationship) { |
|
| 57 | + static::pivotUpdated(function($instance, $secondInstance, $relationship) { |
|
| 58 | 58 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function newEloquentBuilder($query) |
| 72 | 72 | { |
| 73 | - if (! $this->isCachable()) { |
|
| 73 | + if (!$this->isCachable()) { |
|
| 74 | 74 | $this->isCachable = false; |
| 75 | 75 | |
| 76 | 76 | return new EloquentBuilder($query); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | EloquentBuilder $query, |
| 115 | 115 | int $seconds = null |
| 116 | 116 | ) : EloquentBuilder { |
| 117 | - if (! $seconds) { |
|
| 117 | + if (!$seconds) { |
|
| 118 | 118 | $seconds = $this->cacheCooldownSeconds; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 124 | 124 | |
| 125 | 125 | $this->cache() |
| 126 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 126 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 127 | 127 | return $seconds; |
| 128 | 128 | }); |
| 129 | 129 | |
| 130 | 130 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 131 | 131 | $this->cache() |
| 132 | - ->rememberForever($cacheKey, function () { |
|
| 132 | + ->rememberForever($cacheKey, function() { |
|
| 133 | 133 | return (new Carbon)->now(); |
| 134 | 134 | }); |
| 135 | 135 | |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | $class = get_called_class(); |
| 44 | 44 | $instance = new $class; |
| 45 | 45 | |
| 46 | - if (!$instance->isCachable()) { |
|
| 47 | - return parent::all($columns); |
|
| 48 | - } |
|
| 46 | + if (!$instance->isCachable()) { |
|
| 47 | + return parent::all($columns); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | $tags = $instance->makeCacheTags(); |
| 51 | 51 | $key = $instance->makeCacheKey(); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | public function avg($column) |
| 9 | 9 | { |
| 10 | - if (! $this->isCachable()) { |
|
| 10 | + if (!$this->isCachable()) { |
|
| 11 | 11 | return parent::avg($column); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function count($columns = "*") |
| 20 | 20 | { |
| 21 | - if (! $this->isCachable()) { |
|
| 21 | + if (!$this->isCachable()) { |
|
| 22 | 22 | return parent::count($columns); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function find($id, $columns = ["*"]) |
| 50 | 50 | { |
| 51 | - if (! $this->isCachable()) { |
|
| 51 | + if (!$this->isCachable()) { |
|
| 52 | 52 | return parent::find($id, $columns); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function first($columns = ["*"]) |
| 66 | 66 | { |
| 67 | - if (! $this->isCachable()) { |
|
| 67 | + if (!$this->isCachable()) { |
|
| 68 | 68 | return parent::first($columns); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function get($columns = ["*"]) |
| 85 | 85 | { |
| 86 | - if (! $this->isCachable()) { |
|
| 86 | + if (!$this->isCachable()) { |
|
| 87 | 87 | return parent::get($columns); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function max($column) |
| 118 | 118 | { |
| 119 | - if (! $this->isCachable()) { |
|
| 119 | + if (!$this->isCachable()) { |
|
| 120 | 120 | return parent::max($column); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function min($column) |
| 129 | 129 | { |
| 130 | - if (! $this->isCachable()) { |
|
| 130 | + if (!$this->isCachable()) { |
|
| 131 | 131 | return parent::min($column); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $pageName = "page", |
| 143 | 143 | $page = null |
| 144 | 144 | ) { |
| 145 | - if (! $this->isCachable()) { |
|
| 145 | + if (!$this->isCachable()) { |
|
| 146 | 146 | return parent::paginate($perPage, $columns, $pageName, $page); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $result = ""; |
| 164 | 164 | |
| 165 | 165 | foreach ($items as $key => $value) { |
| 166 | - $result .= $glue . $key . $glue . $value; |
|
| 166 | + $result .= $glue.$key.$glue.$value; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return $result; |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | public function pluck($column, $key = null) |
| 173 | 173 | { |
| 174 | - if (! $this->isCachable()) { |
|
| 174 | + if (!$this->isCachable()) { |
|
| 175 | 175 | return parent::pluck($column, $key); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
| 178 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
| 179 | 179 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
| 180 | 180 | |
| 181 | 181 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | public function sum($column) |
| 185 | 185 | { |
| 186 | - if (! $this->isCachable()) { |
|
| 186 | + if (!$this->isCachable()) { |
|
| 187 | 187 | return parent::sum($column); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | public function value($column) |
| 203 | 203 | { |
| 204 | - if (! $this->isCachable()) { |
|
| 204 | + if (!$this->isCachable()) { |
|
| 205 | 205 | return parent::value($column); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | return $this->cache($cacheTags) |
| 277 | 277 | ->rememberForever( |
| 278 | 278 | $hashedCacheKey, |
| 279 | - function () use ($arguments, $cacheKey, $method) { |
|
| 279 | + function() use ($arguments, $cacheKey, $method) { |
|
| 280 | 280 | return [ |
| 281 | 281 | "key" => $cacheKey, |
| 282 | 282 | "value" => parent::{$method}(...$arguments), |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | ->get("laravel-model-caching.use-database-keying"); |
| 13 | 13 | |
| 14 | 14 | if ($useDatabaseKeying) { |
| 15 | - $cachePrefix .= $this->getConnectionName() . ":"; |
|
| 16 | - $cachePrefix .= $this->getDatabaseName() . ":"; |
|
| 15 | + $cachePrefix .= $this->getConnectionName().":"; |
|
| 16 | + $cachePrefix .= $this->getDatabaseName().":"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $cachePrefix .= Container::getInstance() |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | if ($this->model |
| 24 | 24 | && property_exists($this->model, "cachePrefix") |
| 25 | 25 | ) { |
| 26 | - $cachePrefix .= $this->model->cachePrefix . ":"; |
|
| 26 | + $cachePrefix .= $this->model->cachePrefix.":"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return $cachePrefix; |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function applyScopesToInstance() |
| 36 | 36 | { |
| 37 | - if (! property_exists($this, "scopes") |
|
| 37 | + if (!property_exists($this, "scopes") |
|
| 38 | 38 | || $this->scopesAreApplied |
| 39 | 39 | ) { |
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | foreach ($this->scopes as $identifier => $scope) { |
| 44 | - if (! isset($this->scopes[$identifier])) { |
|
| 44 | + if (!isset($this->scopes[$identifier])) { |
|
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->callScope(function () use ($scope) { |
|
| 48 | + $this->callScope(function() use ($scope) { |
|
| 49 | 49 | if ($scope instanceof Closure) { |
| 50 | 50 | $scope($this); |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 104 | 104 | |
| 105 | 105 | $this->cache() |
| 106 | - ->rememberForever($cacheKey, function () { |
|
| 106 | + ->rememberForever($cacheKey, function() { |
|
| 107 | 107 | return (new Carbon)->now(); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function getModelCacheCooldown(Model $instance) : array |
| 182 | 182 | { |
| 183 | - if (! $instance->cacheCooldownSeconds) { |
|
| 183 | + if (!$instance->cacheCooldownSeconds) { |
|
| 184 | 184 | return [null, null, null]; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 190 | 190 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 191 | 191 | |
| 192 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 192 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 193 | 193 | return [null, null, null]; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 220 | 220 | |
| 221 | - if (! $cacheCooldown |
|
| 221 | + if (!$cacheCooldown |
|
| 222 | 222 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 223 | 223 | ) { |
| 224 | 224 | return; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 245 | 245 | |
| 246 | - if (! $cacheCooldown) { |
|
| 246 | + if (!$cacheCooldown) { |
|
| 247 | 247 | $instance->flushCache(); |
| 248 | 248 | |
| 249 | 249 | if ($relationship) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function isCachable() : bool |
| 272 | 272 | { |
| 273 | - $isCacheDisabled = ! Container::getInstance() |
|
| 273 | + $isCacheDisabled = !Container::getInstance() |
|
| 274 | 274 | ->make("config") |
| 275 | 275 | ->get("laravel-model-caching.enabled"); |
| 276 | 276 | $allRelationshipsAreCachable = true; |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | $allRelationshipsAreCachable = collect($this |
| 282 | 282 | ->eagerLoad) |
| 283 | 283 | ->keys() |
| 284 | - ->reduce(function ($carry, $related) { |
|
| 285 | - if (! method_exists($this, $related) |
|
| 284 | + ->reduce(function($carry, $related) { |
|
| 285 | + if (!method_exists($this, $related) |
|
| 286 | 286 | || $carry === false |
| 287 | 287 | ) { |
| 288 | 288 | return $carry; |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | $relatedModel = $this->model->$related()->getRelated(); |
| 292 | 292 | |
| 293 | - if (! method_exists($relatedModel, "isCachable") |
|
| 294 | - || ! $relatedModel->isCachable() |
|
| 293 | + if (!method_exists($relatedModel, "isCachable") |
|
| 294 | + || !$relatedModel->isCachable() |
|
| 295 | 295 | ) { |
| 296 | 296 | return false; |
| 297 | 297 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | return $this->isCachable |
| 305 | - && ! $isCacheDisabled |
|
| 305 | + && !$isCacheDisabled |
|
| 306 | 306 | && $allRelationshipsAreCachable; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 314 | 314 | |
| 315 | 315 | $instance->cache() |
| 316 | - ->rememberForever($cacheKey, function () { |
|
| 316 | + ->rememberForever($cacheKey, function() { |
|
| 317 | 317 | return (new Carbon)->now(); |
| 318 | 318 | }); |
| 319 | 319 | } |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function getLimitClause() : string |
| 60 | 60 | { |
| 61 | - if (! property_exists($this->query, "limit") |
|
| 62 | - || ! $this->query->limit |
|
| 61 | + if (!property_exists($this->query, "limit") |
|
| 62 | + || !$this->query->limit |
|
| 63 | 63 | ) { |
| 64 | 64 | return ""; |
| 65 | 65 | } |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function getOffsetClause() : string |
| 82 | 82 | { |
| 83 | - if (! property_exists($this->query, "offset") |
|
| 84 | - || ! $this->query->offset |
|
| 83 | + if (!property_exists($this->query, "offset") |
|
| 84 | + || !$this->query->offset |
|
| 85 | 85 | ) { |
| 86 | 86 | return ""; |
| 87 | 87 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | protected function getOrderByClauses() : string |
| 93 | 93 | { |
| 94 | - if (! property_exists($this->query, "orders") |
|
| 95 | - || ! $this->query->orders |
|
| 94 | + if (!property_exists($this->query, "orders") |
|
| 95 | + || !$this->query->orders |
|
| 96 | 96 | ) { |
| 97 | 97 | return ""; |
| 98 | 98 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | $orders = collect($this->query->orders); |
| 101 | 101 | |
| 102 | 102 | return $orders |
| 103 | - ->reduce(function ($carry, $order) { |
|
| 103 | + ->reduce(function($carry, $order) { |
|
| 104 | 104 | if (($order["type"] ?? "") === "Raw") { |
| 105 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
| 105 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
| 108 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
| 109 | 109 | }) |
| 110 | 110 | ?: ""; |
| 111 | 111 | } |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | if (($columns === ["*"] |
| 116 | 116 | || $columns === []) |
| 117 | - && (! property_exists($this->query, "columns") |
|
| 118 | - || ! $this->query->columns) |
|
| 117 | + && (!property_exists($this->query, "columns") |
|
| 118 | + || !$this->query->columns) |
|
| 119 | 119 | ) { |
| 120 | 120 | return ""; |
| 121 | 121 | } |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | if (property_exists($this->query, "columns") |
| 124 | 124 | && $this->query->columns |
| 125 | 125 | ) { |
| 126 | - return "_" . implode("_", $this->query->columns); |
|
| 126 | + return "_".implode("_", $this->query->columns); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - return "_" . implode("_", $columns); |
|
| 129 | + return "_".implode("_", $columns); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | protected function getTypeClause($where) : string |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | protected function getValuesClause(array $where = []) : string |
| 142 | 142 | { |
| 143 | - if (! $where |
|
| 143 | + if (!$where |
|
| 144 | 144 | || in_array($where["type"], ["NotNull", "Null"]) |
| 145 | 145 | ) { |
| 146 | 146 | return ""; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $values = $this->getValuesFromWhere($where); |
| 150 | 150 | $values = $this->getValuesFromBindings($where, $values); |
| 151 | 151 | |
| 152 | - return "_" . $values; |
|
| 152 | + return "_".$values; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | protected function getValuesFromWhere(array $where) : string |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->currentBinding++; |
| 180 | 180 | |
| 181 | 181 | if ($where["type"] === "between") { |
| 182 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
| 182 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
| 183 | 183 | $this->currentBinding++; |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | protected function getWhereClauses(array $wheres = []) : string |
| 197 | 197 | { |
| 198 | - return "" . $this->getWheres($wheres) |
|
| 199 | - ->reduce(function ($carry, $where) { |
|
| 198 | + return "".$this->getWheres($wheres) |
|
| 199 | + ->reduce(function($carry, $where) { |
|
| 200 | 200 | $value = $carry; |
| 201 | 201 | $value .= $this->getNestedClauses($where); |
| 202 | 202 | $value .= $this->getColumnClauses($where); |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | protected function getNestedClauses(array $where) : string |
| 212 | 212 | { |
| 213 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 213 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 214 | 214 | return ""; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
| 217 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | protected function getColumnClauses(array $where) : string |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | protected function getInAndNotInClauses(array $where) : string |
| 230 | 230 | { |
| 231 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 231 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 232 | 232 | return ""; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $this->currentBinding += count($where["values"]); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
| 243 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
| 244 | 244 | try { |
| 245 | 245 | $subquery = Uuid::fromBytes($subquery); |
| 246 | 246 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | continue; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $result .= $glue . $value; |
|
| 281 | + $result .= $glue.$value; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return $result; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | protected function getRawClauses(array $where) : string |
| 288 | 288 | { |
| 289 | - if (! in_array($where["type"], ["raw"])) { |
|
| 289 | + if (!in_array($where["type"], ["raw"])) { |
|
| 290 | 290 | return ""; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $clause = "_{$where["boolean"]}"; |
| 295 | 295 | |
| 296 | 296 | while (count($queryParts) > 1) { |
| 297 | - $clause .= "_" . array_shift($queryParts); |
|
| 297 | + $clause .= "_".array_shift($queryParts); |
|
| 298 | 298 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
| 299 | 299 | $this->currentBinding++; |
| 300 | 300 | } |
@@ -302,10 +302,10 @@ discard block |
||
| 302 | 302 | $lastPart = array_shift($queryParts); |
| 303 | 303 | |
| 304 | 304 | if ($lastPart) { |
| 305 | - $clause .= "_" . $lastPart; |
|
| 305 | + $clause .= "_".$lastPart; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - return "-" . str_replace(" ", "_", $clause); |
|
| 308 | + return "-".str_replace(" ", "_", $clause); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | protected function getOtherClauses(array $where) : string |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | return ""; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
| 345 | - if (! method_exists($this->model, $related)) { |
|
| 344 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
| 345 | + if (!method_exists($this->model, $related)) { |
|
| 346 | 346 | return "{$carry}-{$related}"; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | protected function getBindingsSlug() : string |
| 358 | 358 | { |
| 359 | - if (! method_exists($this->model, 'query')) { |
|
| 359 | + if (!method_exists($this->model, 'query')) { |
|
| 360 | 360 | return ''; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function boot() |
| 16 | 16 | { |
| 17 | - $configPath = __DIR__ . '/../../config/laravel-model-caching.php'; |
|
| 17 | + $configPath = __DIR__.'/../../config/laravel-model-caching.php'; |
|
| 18 | 18 | $this->mergeConfigFrom($configPath, 'laravel-model-caching'); |
| 19 | 19 | $this->commands([ |
| 20 | 20 | Clear::class, |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function register() |
| 29 | 29 | { |
| 30 | - if (! class_exists('GeneaLabs\LaravelModelCaching\EloquentBuilder')) { |
|
| 30 | + if (!class_exists('GeneaLabs\LaravelModelCaching\EloquentBuilder')) { |
|
| 31 | 31 | class_alias( |
| 32 | 32 | ModelCaching::builder(), |
| 33 | 33 | 'GeneaLabs\LaravelModelCaching\EloquentBuilder' |