Support the ongoing development of Laravel.io →
posted 6 years ago
Last updated 2 years 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 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Petit Vps petit-vps Joined 15 Mar 2018

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.