[laravel newbie question]
I have a static class that contains pages meta info (title, description, menu links/titles, etc, etc). It doesn't have to be static but this is how it is now.
Assume I have a top bar menu, which is the same for all pages, except may be one submenu, which depends on User.
The question is: what's the right way to push pages meta info to the topbar.blade.php?
- I could just include a php class in blade template and then call it's functions
include_once('../../pagebase.inc')
<li><?=PageMetaFactory::link(PageMetaFactory::HOME_PAGE)?></li>
-
It possible to share this data via view()->share(). However, that means that I have to make it an array. Furthermore, I need this meta data in controllers. So it appears that the best place to store meta data is a base Controller class. But then in order to initialize it in AppServiceProvider I will have to bring Controller dependency into it, which doesn't look right.
-
I could pass meta info as view parameter and then access it in the template but if I have 100 page controllers then each and every will have to do the same thing again - pass the same parameter.
As you may see, I am very confused. What is the best method to address the pages meta data issue? Thank you!