0

I have created an app. I need to add a slider from the App\Slider class to the default app layout view. Which is the most efficient way to do this without having to change my controller logic for each controller?

Is there a way I can add the class and function to the Controller, BaseController, Service Inject an instance of the App\Slideror use and create a ViewComposer. Currently I am stuck on which way would be most efficient as technically I only need to add a foreach loop to the layouts.app.

The controller method is already built.

m33bo
  • 1,334
  • 1
  • 17
  • 34
  • Can you please add some sample code that highlights the issue you are having? – Wolfie Aug 06 '17 at 20:58
  • Thank you for pointing me to the right direction! :) – m33bo Aug 06 '17 at 22:43
  • there is several ways to achieve this, you can initialize the slider into a middleware, or in a service provider, and use view::share to share the slider variable, like so all your blade templates can access it. I hope this is what you need, if not, please share some of your code with us as suggested by @Matthew – Naco Aug 06 '17 at 23:11

0 Answers0