@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->actingAs($user); |
| 112 | 112 | $authorsA = (new AuthorBeginsWithScoped) |
| 113 | 113 | ->all() |
| 114 | - ->map(function ($author) { |
|
| 114 | + ->map(function($author) { |
|
| 115 | 115 | return (new Str)->substr($author->name, 0, 1); |
| 116 | 116 | }) |
| 117 | 117 | ->unique(); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->actingAs($user); |
| 120 | 120 | $authorsB = (new AuthorBeginsWithScoped) |
| 121 | 121 | ->all() |
| 122 | - ->map(function ($author) { |
|
| 122 | + ->map(function($author) { |
|
| 123 | 123 | return (new Str)->substr($author->name, 0, 1); |
| 124 | 124 | }) |
| 125 | 125 | ->unique(); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->actingAs($user); |
| 138 | 138 | $authorsA = (new AuthorBeginsWithScoped) |
| 139 | 139 | ->get() |
| 140 | - ->map(function ($author) { |
|
| 140 | + ->map(function($author) { |
|
| 141 | 141 | return (new Str)->substr($author->name, 0, 1); |
| 142 | 142 | }) |
| 143 | 143 | ->unique(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $this->actingAs($user); |
| 146 | 146 | $authorsB = (new AuthorBeginsWithScoped) |
| 147 | 147 | ->get() |
| 148 | - ->map(function ($author) { |
|
| 148 | + ->map(function($author) { |
|
| 149 | 149 | return (new Str)->substr($author->name, 0, 1); |
| 150 | 150 | }) |
| 151 | 151 | ->unique(); |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | $first = "A"; |
| 162 | 162 | $second = "B"; |
| 163 | 163 | $authors1 = (new Author) |
| 164 | - ->with(['books' => static function (HasMany $model) use ($first) { |
|
| 164 | + ->with(['books' => static function(HasMany $model) use ($first) { |
|
| 165 | 165 | $model->startsWith($first); |
| 166 | 166 | }]) |
| 167 | 167 | ->get(); |
| 168 | 168 | $authors2 = (new Author) |
| 169 | 169 | ->disableModelCaching() |
| 170 | - ->with(['books' => static function (HasMany $model) use ($second) { |
|
| 170 | + ->with(['books' => static function(HasMany $model) use ($second) { |
|
| 171 | 171 | $model->startsWith($second); |
| 172 | 172 | }]) |
| 173 | 173 | ->get(); |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $authors = (new Author) |
| 14 | 14 | ->where("id", 1) |
| 15 | 15 | ->with([ |
| 16 | - 'books' => function ($query) { |
|
| 16 | + 'books' => function($query) { |
|
| 17 | 17 | $query->where("id", "<", 100) |
| 18 | 18 | ->offset(5) |
| 19 | 19 | ->limit(1); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | ]) |
| 22 | 22 | ->first(); |
| 23 | 23 | $uncachedAuthor = (new UncachedAuthor)->with([ |
| 24 | - 'books' => function ($query) { |
|
| 24 | + 'books' => function($query) { |
|
| 25 | 25 | $query->where("id", "<", 100) |
| 26 | 26 | ->offset(5) |
| 27 | 27 | ->limit(1); |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | $author = (new Author) |
| 39 | 39 | ->where("id", 1) |
| 40 | 40 | ->with([ |
| 41 | - 'books' => function ($query) { |
|
| 41 | + 'books' => function($query) { |
|
| 42 | 42 | $query->where("id", "<", 100); |
| 43 | 43 | } |
| 44 | 44 | ]) |
| 45 | 45 | ->first(); |
| 46 | 46 | $uncachedAuthor = (new UncachedAuthor)->with([ |
| 47 | - 'books' => function ($query) { |
|
| 47 | + 'books' => function($query) { |
|
| 48 | 48 | $query->where("id", "<", 100); |
| 49 | 49 | }, |
| 50 | 50 | ]) |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | $author = (new Author) |
| 61 | 61 | ->where("id", 1) |
| 62 | 62 | ->with([ |
| 63 | - 'books.publisher' => function ($query) { |
|
| 63 | + 'books.publisher' => function($query) { |
|
| 64 | 64 | $query->where("id", "<", 100); |
| 65 | 65 | } |
| 66 | 66 | ]) |
| 67 | 67 | ->first(); |
| 68 | 68 | $uncachedAuthor = (new UncachedAuthor)->with([ |
| 69 | - 'books.publisher' => function ($query) { |
|
| 69 | + 'books.publisher' => function($query) { |
|
| 70 | 70 | $query->where("id", "<", 100); |
| 71 | 71 | }, |
| 72 | 72 | ]) |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | ]; |
| 15 | 15 | |
| 16 | 16 | $books = (new Book) |
| 17 | - ->when(true, function ($query) { |
|
| 17 | + ->when(true, function($query) { |
|
| 18 | 18 | $query->where("id", "<", 5); |
| 19 | 19 | }) |
| 20 | 20 | ->get(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | ->tags($tags) |
| 24 | 24 | ->get($key)['value']; |
| 25 | 25 | $liveResults = (new UncachedBook) |
| 26 | - ->when(true, function ($query) { |
|
| 26 | + ->when(true, function($query) { |
|
| 27 | 27 | $query->where("id", "<", 5); |
| 28 | 28 | }) |
| 29 | 29 | ->get(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | (new Book) |
| 14 | 14 | ->get() |
| 15 | - ->each(function ($book) { |
|
| 15 | + ->each(function($book) { |
|
| 16 | 16 | $book->image()->create([ |
| 17 | 17 | "path" => app(Faker::class)->imageUrl(), |
| 18 | 18 | ]); |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | public function testWithQuery() |
| 12 | 12 | { |
| 13 | 13 | $books = (new Book) |
| 14 | - ->where(function ($query) { |
|
| 14 | + ->where(function($query) { |
|
| 15 | 15 | $query->where("id", ">", "1") |
| 16 | 16 | ->where("id", "<", "5"); |
| 17 | 17 | }) |
| 18 | 18 | ->get(); |
| 19 | 19 | $uncachedBooks = (new UncachedBook) |
| 20 | - ->where(function ($query) { |
|
| 20 | + ->where(function($query) { |
|
| 21 | 21 | $query->where("id", ">", "1") |
| 22 | 22 | ->where("id", "<", "5"); |
| 23 | 23 | }) |
@@ -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")); |