回答編集履歴
1
誤字
answer
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
コントローラーの記載を以下のように変更すると求めていた処理を実行できました。
|
2
2
|
```controller
|
3
|
-
$private_items = Item::withoutGlobalScopes()->get();
|
4
|
-
$private_items = $
|
3
|
+
$private_items = $user->items()->withoutGlobalScopes()->where('status', '1')->get();
|
5
4
|
```
|
6
5
|
|
7
6
|
気になる点
|
8
7
|
以下のように引数を入れると"withoutGlobalScopes() must be of the type array or null, string given"のエラーが表示されます。"arrayかnullであるべきなのに、文字列が渡っている" と理解しています。
|
9
8
|
```ここに言語を入力
|
10
|
-
$private_items =
|
9
|
+
$private_items = $user->items()->withoutGlobalScopes()->where('status', '1')->get();
|
11
10
|
⬇️
|
12
|
-
$private_items =
|
11
|
+
$private_items = $user->items()->withoutGlobalScopes(ScopeItem::class)->where('status', '1')->get();
|
13
12
|
```
|
14
13
|
|
15
14
|
なぜstring判定されてしまうのでしょうか?
|