Level 60
One controller is fine.
public function report()
{
$set1 = Model::all();
$set2 = Model2::all();
// ....
return view('report', compact('set1', 'set2', '...');
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i want to display a different tables(table1, table2, table 3, table 4) in one view and and print it as one page
do i need a different controller or one controller? and how the sample code looks like in that controller?
I need just an idea
public function showAll() {
$posts = PostModel::all();
$comments = CommentModel::all();
$users = UserModel::all();
$accounts = AccountModel::all();
return view('views.all')->with(compact('posts','comments','users','accounts'));
}
You do all in one controller. However you should paginate them.
Please or to participate in this conversation.