I am trying to create a menu in Phoenix that has a list based on a database query.
## app.html.heex
<div>
<ul> ## @items = MyApp.Items.Item.list_items
<%= for item <- @items do %>
<li><%= item.name %></li>
<% end %>
...
The menu is used for both live and nonlive pages. I would like to put it in a controller so that it will be called once and not every time a use changes controllers.
How can I make a controller for root.html.heex
or app.html.heex
for this?