I want to make a query result that I use in a warning popup available to my all application regardless of the route, i.e., I would like to use @destaks
in my layout.
Currently I’m limited to a specific route because I’m doing this inside my page_controller
:
def admin(conn, _params) do
destaks = Data.listAll(Destak, nil)
render(conn, "admin.html", destaks: destaks)
end
What’s the cleanest alternative? Creating a plug? Is there a Phoenix predefined approach?