I have post reported page in admin dashboard. Trying to make a page where all reported post will be listed.
This is a forum project so thread, comment and reply can be reported. I have two model, Thread and Comment (for comments and replies).
Here I want to display latest 10 post from thread and comment reported in a single page.
Currently I have this function and do not get how to make it
public function reported()
{
$reported = Thread::where('reported', true)->latest()->paginate(10);
$reportedcomments = Comment::where('reported', true)->latest()->paginate(10);
$categories = Category::get();
return view('admin.thread.reported', compact('reported', 'reportedcomments', 'categories'))->with('i', (request()->input('page', 1) - 1) * 10);
}
How to make these appear in a limited number like 10 of all in a page and then the pagination. Not the 10 and 10, means total 20 from both models.
$reported = Thread::where('reported', true)->latest()->paginate(10);
$reportedcomments = Comment::where('reported', true)->latest()->paginate(10);