You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
->whereGroup(callback: function (WhereGroupBuilder$group): void {
31
+
$group->whereHas(relation: 'chapters');
32
+
})
33
+
->compile();
34
+
35
+
$this->assertSameWithoutBackticks(
36
+
'SELECT books.id AS books.id, books.title AS books.title, books.author_id AS books.author_id FROM books WHERE EXISTS (SELECT 1 FROM chapters WHERE chapters.book_id = books.id)',
->whereGroup(callback: function (WhereGroupBuilder$group): void {
46
+
$group
47
+
->whereHas(relation: 'chapters')
48
+
->orWhereHas(relation: 'isbn');
49
+
})
50
+
->compile();
51
+
52
+
$this->assertSameWithoutBackticks(
53
+
'SELECT books.id AS books.id, books.title AS books.title, books.author_id AS books.author_id FROM books WHERE (EXISTS (SELECT 1 FROM chapters WHERE chapters.book_id = books.id) OR EXISTS (SELECT 1 FROM isbns WHERE isbns.book_id = books.id))',
->whereGroup(callback: function (WhereGroupBuilder$group): void {
63
+
$group
64
+
->whereHas(relation: 'chapters')
65
+
->orWhereDoesntHave(relation: 'isbn');
66
+
})
67
+
->compile();
68
+
69
+
$this->assertSameWithoutBackticks(
70
+
'SELECT books.id AS books.id, books.title AS books.title, books.author_id AS books.author_id FROM books WHERE (EXISTS (SELECT 1 FROM chapters WHERE chapters.book_id = books.id) OR NOT EXISTS (SELECT 1 FROM isbns WHERE isbns.book_id = books.id))',
'SELECT books.id AS books.id, books.title AS books.title, books.author_id AS books.author_id FROM books WHERE EXISTS (SELECT 1 FROM chapters WHERE chapters.book_id = books.id AND chapters.title = ?)',
->orWhereGroup(callback: function (WhereGroupBuilder$group): void {
101
+
$group
102
+
->whereHas(relation: 'chapters')
103
+
->orWhereHas(relation: 'isbn');
104
+
})
105
+
->compile();
106
+
107
+
$this->assertSameWithoutBackticks(
108
+
'SELECT books.id AS books.id, books.title AS books.title, books.author_id AS books.author_id FROM books WHERE books.title = ? OR (EXISTS (SELECT 1 FROM chapters WHERE chapters.book_id = books.id) OR EXISTS (SELECT 1 FROM isbns WHERE isbns.book_id = books.id))',
0 commit comments