I’m trying to send a list to sidebar_content.blade.php
. The idea would be getting the menu items from a database. I guess I should add the variable to the @include
in every subview in the “chain”, but I don’t know which controller (if any) starts that chain.
I have read the docs and tried to find tutorials, projects or people asking similar things, but I found nothing. I know how to get the menu items from inside sidebar_content.blade.php
, but that looks wrong.
How should I go about doing this? I’m extremely new to both Laravel and Backpack, so it’s very likely that I’m misunderstanding something basic.
Advertisement
Answer
The easiest way would be to get the entries right there in sidebar_content.blade.php
.
But like you said, it’s probably a good idea to separate the entry-getting logic. The easiest way to do that would be to include a custom view inside sidebar_content
, maybe something like… database_sidebar_entries.blade.php
… and put your DB logic inside a Laravel view composer.