回答編集履歴
1
追記
test
CHANGED
@@ -11,3 +11,13 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
[How to Paginate Eloquent hasMany relation?](https://laracasts.com/discuss/channels/laravel/how-to-paginate-eloquent-hasmany-relation)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
[追記] $postのリレーションとして設定したい場合
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
$post->setRelation('comments', $post->comments()->paginate(5));
|
22
|
+
|
23
|
+
```
|