@@ -15,7 +15,7 @@ |
||
15 | 15 | ->first(); |
16 | 16 | factory(Book::class, 1) |
17 | 17 | ->make() |
18 | - ->each(function ($book) use ($author1) { |
|
18 | + ->each(function($book) use ($author1) { |
|
19 | 19 | $publisher = (new Publisher)->first(); |
20 | 20 | $book->author()->associate($author1); |
21 | 21 | $book->publisher()->associate($publisher); |
@@ -54,13 +54,13 @@ |
||
54 | 54 | public function testWithMultipleMorphModelsWithClosure() |
55 | 55 | { |
56 | 56 | $comments = (new Comment) |
57 | - ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) { |
|
58 | - return $query->where('subject', 'like', '%uncached post'); |
|
57 | + ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) { |
|
58 | + return $query->where('subject', 'like', '%uncached post'); |
|
59 | 59 | }) |
60 | 60 | ->get(); |
61 | 61 | $uncachedComments = (new UncachedComment()) |
62 | - ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) { |
|
63 | - return $query->where('subject', 'like', '%uncached post'); |
|
62 | + ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) { |
|
63 | + return $query->where('subject', 'like', '%uncached post'); |
|
64 | 64 | }) |
65 | 65 | ->get(); |
66 | 66 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ->whereRaw("name != 'test3'") |
35 | 35 | ->whereRaw('name = ? AND name != ?', [$authorName, "test2"]) |
36 | 36 | ->get(); |
37 | - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_" . str_replace(" ", "_", $authorName) . "__AND_name_!=_test2-authors.deleted_at_null"); |
|
37 | + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_".str_replace(" ", "_", $authorName)."__AND_name_!=_test2-authors.deleted_at_null"); |
|
38 | 38 | $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; |
39 | 39 | |
40 | 40 | $cachedResults = collect([$this->cache()->tags($tags)->get($key)['value']]); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ]; |
71 | 71 | |
72 | 72 | $authors = (new Author) |
73 | - ->where(function ($query) { |
|
73 | + ->where(function($query) { |
|
74 | 74 | $query->orWhereRaw("id BETWEEN 1 AND 3") |
75 | 75 | ->orWhereRaw("id BETWEEN 5 AND 6"); |
76 | 76 | }) |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | public function testNestedWhereRawWithBindings() |
83 | 83 | { |
84 | 84 | $books = (new Book) |
85 | - ->where(function ($query) { |
|
86 | - $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%',]); |
|
85 | + ->where(function($query) { |
|
86 | + $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%', ]); |
|
87 | 87 | })->get(); |
88 | 88 | |
89 | 89 | $uncachedBooks = (new UncachedBook) |
90 | - ->where(function ($query) { |
|
91 | - $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%',]); |
|
90 | + ->where(function($query) { |
|
91 | + $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%', ]); |
|
92 | 92 | })->get(); |
93 | 93 | |
94 | 94 | $this->assertEquals($books->pluck("id"), $uncachedBooks->pluck("id")); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); |
12 | 12 | $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; |
13 | 13 | |
14 | - $authors = app("model-cache")->runDisabled(function () { |
|
14 | + $authors = app("model-cache")->runDisabled(function() { |
|
15 | 15 | return (new Author) |
16 | 16 | ->get(); |
17 | 17 | }); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $books = (new Book) |
112 | 112 | ->with('author') |
113 | - ->whereHas('author', function ($query) { |
|
113 | + ->whereHas('author', function($query) { |
|
114 | 114 | $query->whereId('1'); |
115 | 115 | }) |
116 | 116 | ->get(); |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | { |
135 | 135 | $books1 = (new Book) |
136 | 136 | ->with('author') |
137 | - ->whereHas('author', function ($query) { |
|
137 | + ->whereHas('author', function($query) { |
|
138 | 138 | $query->whereId(1); |
139 | 139 | }) |
140 | 140 | ->get() |
141 | 141 | ->keyBy('id'); |
142 | 142 | $books2 = (new Book) |
143 | 143 | ->with('author') |
144 | - ->whereHas('author', function ($query) { |
|
144 | + ->whereHas('author', function($query) { |
|
145 | 145 | $query->whereId(2); |
146 | 146 | }) |
147 | 147 | ->get() |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" |
49 | 49 | ]) |
50 | 50 | ->get(sha1( |
51 | - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" . |
|
51 | + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_". |
|
52 | 52 | "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks" |
53 | 53 | )); |
54 | 54 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" |
67 | 67 | ]) |
68 | 68 | ->get(sha1( |
69 | - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" . |
|
69 | + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_". |
|
70 | 70 | "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks" |
71 | 71 | )); |
72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" |
84 | 84 | ]) |
85 | 85 | ->get(sha1( |
86 | - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" . |
|
86 | + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_". |
|
87 | 87 | "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks" |
88 | 88 | )); |
89 | 89 | |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | $chunkedKeys = []; |
187 | 187 | $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; |
188 | 188 | (new Author) |
189 | - ->chunk(3, function ($authors) use (&$chunkedAuthors, &$chunkedKeys) { |
|
189 | + ->chunk(3, function($authors) use (&$chunkedAuthors, &$chunkedKeys) { |
|
190 | 190 | $offset = ""; |
191 | 191 | |
192 | 192 | if (count($chunkedKeys)) { |
193 | - $offset = "-offset_" . (count($chunkedKeys) * 3); |
|
193 | + $offset = "-offset_".(count($chunkedKeys) * 3); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_authors.id_asc{$offset}-limit_3"; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | ->tags($tags1) |
664 | 664 | ->rememberForever( |
665 | 665 | $key1, |
666 | - function () use ($key2, $authors) { |
|
666 | + function() use ($key2, $authors) { |
|
667 | 667 | return [ |
668 | 668 | 'key' => $key2, |
669 | 669 | 'value' => $authors, |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $authors = (new Author)->with('books', 'profile') |
52 | 52 | ->disableCache() |
53 | - ->chunk($chunkSize, function ($chunk) use (&$cachedChunks, $chunkSize) { |
|
53 | + ->chunk($chunkSize, function($chunk) use (&$cachedChunks, $chunkSize) { |
|
54 | 54 | $offset = ''; |
55 | 55 | |
56 | 56 | if ($cachedChunks['authors']->count()) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | }); |
66 | 66 | |
67 | 67 | $liveResults = (new UncachedAuthor)->with('books', 'profile') |
68 | - ->chunk($chunkSize, function ($chunk) use (&$uncachedChunks) { |
|
68 | + ->chunk($chunkSize, function($chunk) use (&$uncachedChunks) { |
|
69 | 69 | $uncachedChunks->push($chunk); |
70 | 70 | }); |
71 | 71 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** @var Collection $publishers */ |
20 | 20 | $publishers = factory(UncachedPublisher::class, 5)->create(); |
21 | 21 | |
22 | - $publishers->each(function (UncachedPublisher $publisher) { |
|
22 | + $publishers->each(function(UncachedPublisher $publisher) { |
|
23 | 23 | factory(UncachedBook::class, 2)->create(['publisher_id' => $publisher->id]); |
24 | 24 | }); |
25 | 25 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function avg($column) |
11 | 11 | { |
12 | - if (! $this->isCachable()) { |
|
12 | + if (!$this->isCachable()) { |
|
13 | 13 | return parent::avg($column); |
14 | 14 | } |
15 | 15 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function count($columns = "*") |
22 | 22 | { |
23 | - if (! $this->isCachable()) { |
|
23 | + if (!$this->isCachable()) { |
|
24 | 24 | return parent::count($columns); |
25 | 25 | } |
26 | 26 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function exists() |
33 | 33 | { |
34 | - if (! $this->isCachable()) { |
|
34 | + if (!$this->isCachable()) { |
|
35 | 35 | return parent::exists(); |
36 | 36 | } |
37 | 37 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function find($id, $columns = ["*"]) |
63 | 63 | { |
64 | - if (! $this->isCachable()) { |
|
64 | + if (!$this->isCachable()) { |
|
65 | 65 | return parent::find($id, $columns); |
66 | 66 | } |
67 | 67 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function first($columns = ["*"]) |
80 | 80 | { |
81 | - if (! $this->isCachable()) { |
|
81 | + if (!$this->isCachable()) { |
|
82 | 82 | return parent::first($columns); |
83 | 83 | } |
84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function get($columns = ["*"]) |
100 | 100 | { |
101 | - if (! $this->isCachable()) { |
|
101 | + if (!$this->isCachable()) { |
|
102 | 102 | return parent::get($columns); |
103 | 103 | } |
104 | 104 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public function max($column) |
136 | 136 | { |
137 | - if (! $this->isCachable()) { |
|
137 | + if (!$this->isCachable()) { |
|
138 | 138 | return parent::max($column); |
139 | 139 | } |
140 | 140 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function min($column) |
147 | 147 | { |
148 | - if (! $this->isCachable()) { |
|
148 | + if (!$this->isCachable()) { |
|
149 | 149 | return parent::min($column); |
150 | 150 | } |
151 | 151 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $pageName = "page", |
161 | 161 | $page = null |
162 | 162 | ) { |
163 | - if (! $this->isCachable()) { |
|
163 | + if (!$this->isCachable()) { |
|
164 | 164 | return parent::paginate($perPage, $columns, $pageName, $page); |
165 | 165 | } |
166 | 166 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $result = ""; |
185 | 185 | |
186 | 186 | foreach ($items as $key => $value) { |
187 | - $result .= $glue . $key . $glue . $value; |
|
187 | + $result .= $glue.$key.$glue.$value; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | return $result; |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | |
193 | 193 | public function pluck($column, $key = null) |
194 | 194 | { |
195 | - if (! $this->isCachable()) { |
|
195 | + if (!$this->isCachable()) { |
|
196 | 196 | return parent::pluck($column, $key); |
197 | 197 | } |
198 | 198 | |
199 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
199 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
200 | 200 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
201 | 201 | |
202 | 202 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | public function sum($column) |
206 | 206 | { |
207 | - if (! $this->isCachable()) { |
|
207 | + if (!$this->isCachable()) { |
|
208 | 208 | return parent::sum($column); |
209 | 209 | } |
210 | 210 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | public function value($column) |
226 | 226 | { |
227 | - if (! $this->isCachable()) { |
|
227 | + if (!$this->isCachable()) { |
|
228 | 228 | return parent::value($column); |
229 | 229 | } |
230 | 230 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | return $this->cache($cacheTags) |
300 | 300 | ->rememberForever( |
301 | 301 | $hashedCacheKey, |
302 | - function () use ($arguments, $cacheKey, $method) { |
|
302 | + function() use ($arguments, $cacheKey, $method) { |
|
303 | 303 | return [ |
304 | 304 | "key" => $cacheKey, |
305 | 305 | "value" => parent::{$method}(...$arguments), |