Hello Guys,
I have used View Composers in which it manipulates some data from Database and shares the data to every view. And also I have been using multiple separate views inside the main view. Database queries are fetching for every sub view also.. I need View composers to executed for Main view alone which renders master layout. Is there any choice to restrict views composers to work only for the Main view ? We have 100-200 Main pages. It will be difficult to add them in the composer service provider like this
View::composer( ['profile', 'dashboard'], 'App\Http\ViewComposers\MyViewComposer' );
I dont want to use this also View::composer( '*', 'App\Http\ViewComposers\MyViewComposer' );
Example: main-view.blade.php
<div>Test</div> include('sub-view1') include('sub-view2') include('sub-view3')I need to run only for Main view...
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community