update: keep track of current post being read in a forum topic

This commit is contained in:
Roardom
2024-02-13 11:04:33 +00:00
parent 9fe4abd3b1
commit 45abd69c9d
17 changed files with 634 additions and 75 deletions
@@ -26,7 +26,12 @@ class TopicController extends Controller
return view('user.topic.index', [
'user' => $user,
'topics' => $user->topics()
->with(['user.group', 'latestPoster', 'forum:id,name'])
->with([
'user.group',
'latestPoster',
'forum:id,name',
'reads' => fn ($query) => $query->whereBelongsTo(auth()->user()),
])
->whereRelation('forumPermissions', [['read_topic', '=', 1], ['group_id', '=', auth()->user()->group_id]])
->latest()
->paginate(25),