$replyData = ForumReply::where('archive_id', $archive_id)
->with('thread',['archive'=> function ($query) {
$query->select('id','your_column');
}])
->orderBy('id', 'desc')
->paginate(5)
->toArray();
这样试试?实在不行,你可以这样:
$replyData = ForumReply::where('archive_id', $archive_id)
->with('thread')
->with(['archive'=> function ($query) {
$query->select('id','your_column');
}])
->orderBy('id', 'desc')
->paginate(5)
->toArray();