If I'm not mistaken in CodeIgniter 4 there was a method for setting variables to be available to all views. Is it possible to do the same in CI4? An example of what I want to achieve is:
I have a logged in user name stored in a variable. I want to have it available for all header views in every method which uses the view in Dashboard controller. I guess I could just call session() in my view and pull data from there, but that's not the best way to use views, I guess. I'd rather pull the data from session somewhere once and assign it to a globally-available-for-views variable instead.
As things stand I'm passing my variables to my header view every time the view is needed in Dashboard, which results in a lot of repeated coded in controllers.
Any help on this appreciated

.