I have my packaging layout in app.blade.php, and for this I need dynamic data, say a list of categories displayed at the top of each view.
Following best practices, what would you do in Laravel 5?
To create a new service provider that downloads the new View Composer and sets the dynamic data for presentation in the compose () method (as a newbie, it looks like a lot of work for something so common)
To create a BaseController, set dynamic data for the view form and make each controller in my application to expand it.
I think this is a very common scenario. Imagine, for example, something like <h1>{{ pageTitle }}</h1>in app.blade.php that needs to be installed on each controller. But I could not find the right way to do this so far.
source
share