Maybe you could check about "Laravel View Composers" to do wath you want. Here's the link to the documentation : http://laravel.com/docs/responses#view-composers .
One thing I don't get, this might be more of a MVC related question: how is using composers different from using controllers? When should I use one or the other, since they do pretty much the same thing (processing code to be shown in the view)
A composer is a recurring task which is bound to a specific view, so if you want to display a menu that you have stored in a database or some links in a footer that you have also stored in a database and that no matter which page you're on, then you should use a view composer.
But, if you want to do something on a specific page with some logic behind (like form validation, storing data, etc...), then you have to use a controller.
I'm not sure if it's enough clear but you can check this video from Jeffrey Way about view composers : https://laracasts.com/lessons/view-composers .
Thanks man, this was of great help! I'm discovering laravel now and it's awesome
You're welcome :).
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.