I have a blade template called 'main' and I wonder how I can render a sub template by calling a controllers method in my main template. Lets say I have a Controller WidgetsController
with a method getSubView
. The method returns a specific view with some data from (for instance) a database.
I already tried to @include
a template but this will not call the controller which sets some necessary data to the view.
Thanks.
I don't entirely understand your question.
I think what you are looking for is a View Composer
It allows you to get data for a subview without having to create the data in every controller.