A controller is a class. So you can create a new instance and access its methods. E.g.:
$controller = new HomeController;
echo $controller->topRated();
However, the proper way is to either use View::share() or View::composer()
You could put a View::share in your constructor(s) to pass it to all your views:
View::share('topRated', $data);
Or look into View Composers for more advanced ways to share data with your views.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community