Completed
Push — master ( 1f7144...340aef )
by Mike
11s
created
src/CachedModel.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
         $class = get_called_class();
24 24
         $instance = new $class;
25 25
 
26
-        static::created(function () use ($instance) {
26
+        static::created(function() use ($instance) {
27 27
             $instance->flushCache();
28 28
         });
29 29
 
30
-        static::deleted(function () use ($instance) {
30
+        static::deleted(function() use ($instance) {
31 31
             $instance->flushCache();
32 32
         });
33 33
 
34
-        static::saved(function () use ($instance) {
34
+        static::saved(function() use ($instance) {
35 35
             $instance->flushCache();
36 36
         });
37 37
 
38
-        static::updated(function () use ($instance) {
38
+        static::updated(function() use ($instance) {
39 39
             $instance->flushCache();
40 40
         });
41 41
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $key = 'genealabslaravelmodelcachingtestsfixturesauthor';
66 66
 
67 67
         return $instance->cache($tags)
68
-            ->rememberForever($key, function () use ($columns) {
68
+            ->rememberForever($key, function() use ($columns) {
69 69
                 return parent::all($columns);
70 70
             });
71 71
     }
Please login to merge, or discard this patch.
src/CachedBuilder.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     protected function getLimitClause() : string
43 43
     {
44
-        if (! $this->query->limit) {
44
+        if (!$this->query->limit) {
45 45
             return '';
46 46
         }
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function getOffsetClause() : string
57 57
     {
58
-        if (! $this->query->offset) {
58
+        if (!$this->query->offset) {
59 59
             return '';
60 60
         }
61 61
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
             return '';
69 69
         }
70 70
 
71
-        return '_' . implode('_', $columns);
71
+        return '_'.implode('_', $columns);
72 72
     }
73 73
 
74 74
     protected function getWhereClauses() : string
75 75
     {
76
-        return collect($this->query->wheres)->reduce(function ($carry, $where) {
76
+        return collect($this->query->wheres)->reduce(function($carry, $where) {
77 77
             $value = array_get($where, 'value');
78 78
 
79 79
             if (in_array($where['type'], ['In', 'Null', 'NotNull'])) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             }
82 82
 
83 83
             if (is_array(array_get($where, 'values'))) {
84
-                $value .= '_' . implode('_', $where['values']);
84
+                $value .= '_'.implode('_', $where['values']);
85 85
             }
86 86
 
87 87
             return "{$carry}-{$where['column']}_{$value}";
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
             return '';
97 97
         }
98 98
 
99
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
99
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
100 100
     }
101 101
 
102 102
     protected function getCacheTags() : array
103 103
     {
104 104
         return collect($this->eagerLoad)->keys()
105
-            ->map(function ($relationName) {
105
+            ->map(function($relationName) {
106 106
                 $relation = collect(explode('.', $relationName))
107
-                    ->reduce(function ($carry, $name) {
108
-                        if (! $carry) {
107
+                    ->reduce(function($carry, $name) {
108
+                        if (!$carry) {
109 109
                             $carry = $this->model;
110 110
                         }
111 111
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
     public function avg($column)
127 127
     {
128 128
         $tags = [str_slug(get_class($this->model))];
129
-        $key = str_slug(get_class($this->model)) ."-avg_{$column}";
129
+        $key = str_slug(get_class($this->model))."-avg_{$column}";
130 130
 
131 131
         return $this->cache($tags)
132
-            ->rememberForever($key, function () use ($column) {
132
+            ->rememberForever($key, function() use ($column) {
133 133
                 return parent::avg($column);
134 134
             });
135 135
     }
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
     public function count($columns = ['*'])
138 138
     {
139 139
         $tags = [str_slug(get_class($this->model))];
140
-        $key = str_slug(get_class($this->model)) ."-count";
140
+        $key = str_slug(get_class($this->model))."-count";
141 141
 
142 142
         return $this->cache($tags)
143
-            ->rememberForever($key, function () use ($columns) {
143
+            ->rememberForever($key, function() use ($columns) {
144 144
                 return parent::count($columns);
145 145
             });
146 146
     }
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     public function cursor()
149 149
     {
150 150
         $tags = [str_slug(get_class($this->model))];
151
-        $key = str_slug(get_class($this->model)) ."-cursor";
151
+        $key = str_slug(get_class($this->model))."-cursor";
152 152
 
153 153
         return $this->cache($tags)
154
-            ->rememberForever($key, function () {
154
+            ->rememberForever($key, function() {
155 155
                 return collect(parent::cursor());
156 156
             });
157 157
     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $key = $this->getCacheKey($columns, $id);
166 166
 
167 167
         return $this->cache($tags)
168
-            ->rememberForever($key, function () use ($id, $columns) {
168
+            ->rememberForever($key, function() use ($id, $columns) {
169 169
                 return parent::find($id, $columns);
170 170
             });
171 171
     }
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
     public function first($columns = ['*'])
174 174
     {
175 175
         $tags = $this->getCacheTags();
176
-        $key = $this->getCacheKey($columns) . '-first';
176
+        $key = $this->getCacheKey($columns).'-first';
177 177
 
178 178
         return $this->cache($tags)
179
-            ->rememberForever($key, function () use ($columns) {
179
+            ->rememberForever($key, function() use ($columns) {
180 180
                 return parent::first($columns);
181 181
             });
182 182
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $key = $this->getCacheKey($columns);
188 188
 
189 189
         return $this->cache($tags)
190
-            ->rememberForever($key, function () use ($columns) {
190
+            ->rememberForever($key, function() use ($columns) {
191 191
                 return parent::get($columns);
192 192
             });
193 193
     }
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
     public function max($column)
196 196
     {
197 197
         $tags = [str_slug(get_class($this->model))];
198
-        $key = str_slug(get_class($this->model)) ."-max_{$column}";
198
+        $key = str_slug(get_class($this->model))."-max_{$column}";
199 199
 
200 200
         return $this->cache($tags)
201
-            ->rememberForever($key, function () use ($column) {
201
+            ->rememberForever($key, function() use ($column) {
202 202
                 return parent::max($column);
203 203
             });
204 204
     }
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
     public function min($column)
207 207
     {
208 208
         $tags = [str_slug(get_class($this->model))];
209
-        $key = str_slug(get_class($this->model)) ."-min_{$column}";
209
+        $key = str_slug(get_class($this->model))."-min_{$column}";
210 210
 
211 211
         return $this->cache($tags)
212
-            ->rememberForever($key, function () use ($column) {
212
+            ->rememberForever($key, function() use ($column) {
213 213
                 return parent::min($column);
214 214
             });
215 215
     }
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
     public function pluck($column, $key = null)
218 218
     {
219 219
         $tags = $this->getCacheTags();
220
-        $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}";
220
+        $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}";
221 221
 
222 222
         if ($key) {
223 223
             $cacheKey .= "_{$key}";
224 224
         }
225 225
 
226 226
         return $this->cache($tags)
227
-            ->rememberForever($cacheKey, function () use ($column, $key) {
227
+            ->rememberForever($cacheKey, function() use ($column, $key) {
228 228
                 return parent::pluck($column, $key);
229 229
             });
230 230
     }
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
     public function sum($column)
233 233
     {
234 234
         $tags = [str_slug(get_class($this->model))];
235
-        $key = str_slug(get_class($this->model)) ."-sum_{$column}";
235
+        $key = str_slug(get_class($this->model))."-sum_{$column}";
236 236
 
237 237
         return $this->cache($tags)
238
-            ->rememberForever($key, function () use ($column) {
238
+            ->rememberForever($key, function() use ($column) {
239 239
                 return parent::sum($column);
240 240
             });
241 241
     }
Please login to merge, or discard this patch.