回答編集履歴
1
修正
test
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
```php
|
2
2
|
|
3
|
-
DB::table('table')->where(function (Builder $builder) use ($start_date, $end_date) {
|
3
|
+
\DB::table('table')->where(function (Builder $builder) use ($start_date, $end_date) {
|
4
4
|
|
5
|
-
|
5
|
+
$builder->where(function (Builder $builder) use ($start_date, $end_date) {
|
6
6
|
|
7
|
-
|
7
|
+
$builder->whereDate('start_date', '<=', $start_date)
|
8
8
|
|
9
|
-
|
9
|
+
->whereDate('end_date', '>=', $end_date);
|
10
10
|
|
11
|
-
|
11
|
+
})->orWhere(function (Builder $builder) use ($start_date, $end_date) {
|
12
12
|
|
13
|
-
|
13
|
+
$builder->whereDate('start_date', '>=', $start_date)
|
14
14
|
|
15
|
-
|
15
|
+
->whereDate('end_date', '<>>=', $end_date);
|
16
16
|
|
17
|
-
|
17
|
+
});
|
18
18
|
|
19
|
-
})
|
20
|
-
|
21
|
-
|
19
|
+
})->get();
|
22
20
|
|
23
21
|
```
|