回答編集履歴
2
追記
answer
CHANGED
@@ -14,4 +14,12 @@
|
|
14
14
|
{{ $post->user->id }}
|
15
15
|
</div>
|
16
16
|
@endforeach
|
17
|
+
```
|
18
|
+
|
19
|
+
```php
|
20
|
+
|
21
|
+
public function user()
|
22
|
+
{
|
23
|
+
return $this->belongsTo('App\User')->withDefault();
|
24
|
+
}
|
17
25
|
```
|
1
追記
answer
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
```php
|
4
4
|
public function index()
|
5
5
|
{
|
6
|
-
$all_posts = [];
|
7
6
|
$posts = Post::with('photos', 'user')->get();
|
8
7
|
return view('home')->with('posts', $posts);
|
9
8
|
}
|