質問編集履歴

2

edit

2020/11/18 12:56

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -114,13 +114,27 @@
114
114
 
115
115
  $comments = $post->comment;
116
116
 
117
- $comments_user = $post->comment->user->name;
117
+ $comments_user = $post->comment->user->name; //これや
118
+
119
+ $comments_user = $comments->user->name; //これを試した
118
120
 
119
121
  ```
120
122
 
121
123
 
122
124
 
123
125
  `$comments = $post->comment;`までは取得することができ、該当するデータ`post_id`, `user_id`, `content`を確認することができた。
126
+
127
+
128
+
129
+
130
+
131
+ ## 発生エラー
132
+
133
+ ```
134
+
135
+ Property [user] does not exist on this collection instance.
136
+
137
+ ```
124
138
 
125
139
 
126
140
 

1

edit

2020/11/18 12:55

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- comments_table
7
+ テーブル名: `comments`
8
8
 
9
9
  ```php
10
10
 
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- users_table
29
+ テーブル名: `users`
30
30
 
31
31
 
32
32
 
@@ -120,6 +120,10 @@
120
120
 
121
121
 
122
122
 
123
+ `$comments = $post->comment;`までは取得することができ、該当するデータ`post_id`, `user_id`, `content`を確認することができた。
124
+
125
+
126
+
123
127
 
124
128
 
125
129
  ### 環境