@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | factory(Author::class, 10)->create() |
24 | 24 | ->each(function($author) { |
25 | 25 | factory(Book::class, random_int(2, 10))->make() |
26 | - ->each(function ($book) use ($author) { |
|
26 | + ->each(function($book) use ($author) { |
|
27 | 27 | $book->author()->associate($author); |
28 | 28 | $book->save(); |
29 | 29 | }); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $bookIds = (new Book)->all()->pluck('id'); |
36 | 36 | factory(Store::class, 10)->create() |
37 | - ->each(function ($store) use ($bookIds) { |
|
37 | + ->each(function($store) use ($bookIds) { |
|
38 | 38 | $store->books()->sync(rand($bookIds->min(), $bookIds->max())); |
39 | 39 | }); |
40 | 40 | cache()->flush(); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $uncachedChunks = collect(); |
213 | 213 | |
214 | 214 | (new Author)->with('books', 'profile') |
215 | - ->chunk($chunkSize, function ($chunk) use (&$cachedChunks, $chunkSize) { |
|
215 | + ->chunk($chunkSize, function($chunk) use (&$cachedChunks, $chunkSize) { |
|
216 | 216 | $offset = ''; |
217 | 217 | |
218 | 218 | if ($cachedChunks['authors']->count()) { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | }); |
226 | 226 | |
227 | 227 | (new UncachedAuthor)->with('books', 'profile') |
228 | - ->chunk($chunkSize, function ($chunk) use (&$uncachedChunks) { |
|
228 | + ->chunk($chunkSize, function($chunk) use (&$uncachedChunks) { |
|
229 | 229 | $uncachedChunks->push($chunk); |
230 | 230 | }); |
231 | 231 |
@@ -23,19 +23,19 @@ discard block |
||
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 |
||
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 | } |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | $key = str_slug(get_class($this->model)); |
55 | 55 | |
56 | 56 | if ($ids) { |
57 | - $key .= '_' . (is_array($ids) |
|
57 | + $key .= '_'.(is_array($ids) |
|
58 | 58 | ? implode('_', $ids) |
59 | 59 | : $ids); |
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($columns !== ['*']) { |
63 | - $key .= '_' . implode('_', $columns); |
|
63 | + $key .= '_'.implode('_', $columns); |
|
64 | 64 | } |
65 | 65 | |
66 | - $key .= collect($this->query->wheres)->reduce(function ($carry, $where) { |
|
66 | + $key .= collect($this->query->wheres)->reduce(function($carry, $where) { |
|
67 | 67 | $value = $where['value'] ?? implode('_', $where['values']) ?? ''; |
68 | 68 | |
69 | 69 | return "{$carry}-{$where['column']}_{$value}"; |
70 | 70 | }); |
71 | 71 | |
72 | 72 | if (collect($this->eagerLoad)->isNotEmpty()) { |
73 | - $key .= '-' . implode('-', collect($this->eagerLoad)->keys()->toArray()); |
|
73 | + $key .= '-'.implode('-', collect($this->eagerLoad)->keys()->toArray()); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($this->query->offset) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | protected function getCacheTags() : array |
88 | 88 | { |
89 | 89 | return collect($this->eagerLoad)->keys() |
90 | - ->map(function ($name) { |
|
90 | + ->map(function($name) { |
|
91 | 91 | return str_slug(get_class( |
92 | 92 | $this->model |
93 | 93 | ->{$name}() |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | public function count($columns = ['*']) |
104 | 104 | { |
105 | 105 | $tags = [str_slug(get_class($this->model))]; |
106 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
106 | + $key = str_slug(get_class($this->model))."-count"; |
|
107 | 107 | |
108 | 108 | return $this->cache($tags) |
109 | - ->rememberForever($key, function () use ($columns) { |
|
109 | + ->rememberForever($key, function() use ($columns) { |
|
110 | 110 | return parent::count($columns); |
111 | 111 | }); |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $key = $this->getCacheKey($columns, $id); |
121 | 121 | |
122 | 122 | return $this->cache($tags) |
123 | - ->rememberForever($key, function () use ($id, $columns) { |
|
123 | + ->rememberForever($key, function() use ($id, $columns) { |
|
124 | 124 | return parent::find($id, $columns); |
125 | 125 | }); |
126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $key = $this->getCacheKey($columns); |
132 | 132 | |
133 | 133 | return $this->cache($tags) |
134 | - ->rememberForever($key, function () use ($columns) { |
|
134 | + ->rememberForever($key, function() use ($columns) { |
|
135 | 135 | return parent::first($columns); |
136 | 136 | }); |
137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $key = $this->getCacheKey($columns); |
143 | 143 | |
144 | 144 | return $this->cache($tags) |
145 | - ->rememberForever($key, function () use ($columns) { |
|
145 | + ->rememberForever($key, function() use ($columns) { |
|
146 | 146 | return parent::get($columns); |
147 | 147 | }); |
148 | 148 | } |