@@ -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 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | factory(Book::class)->create(['author_id' => $expectedAuthor->getKey(), 'title' => 'Mixed Clause']); |
| 68 | 68 | |
| 69 | 69 | $books = (new Book) |
| 70 | - ->whereHas('author', function ($query) { |
|
| 70 | + ->whereHas('author', function($query) { |
|
| 71 | 71 | return $query->where('is_famous', false); |
| 72 | 72 | }) |
| 73 | 73 | ->whereRaw("title = ?", ['Mixed Clause']) // Test ensures this binding is included in the key |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | ->tags($tags) |
| 77 | 77 | ->get($key)['value']; |
| 78 | 78 | $liveResults = (new UncachedBook) |
| 79 | - ->whereHas('author', function ($query) { |
|
| 79 | + ->whereHas('author', function($query) { |
|
| 80 | 80 | return $query->where('is_famous', false); |
| 81 | 81 | }) |
| 82 | 82 | ->whereRaw("title = ?", ['Mixed Clause']) |