Support the ongoing development of Laravel.io →
4 years ago
Last updated 3 months ago.
0

You should gather the data you need and pass it into the same view.

For instance:

public function index() {
$teams = Team::all();
$products = Product::all();

return view("main",["teams" => $teams, "products" => $products]);

}

Then, consider that if you have two controllers performing exactly the same method, it is unlikely that you need to have both.

Last updated 4 years ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Petit Vps Petit Vps petit-vps Joined 15 Mar 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.