If I am not mistaken, the point is that
App.php is related and meant for views that use
app.blade.php layout. So in other words, the functions here should provide data for the layout.
helpers.php on the other hand is supposed to be for generally accessible functions, that are perhaps not related to view data as much, right?
Or is there a better rule/convention to use here?
Sometimes I get mixed up and not sure where to put the functions, since the majority of my views use one layout, except for the frontpage which has a separate one.
For example I have
get_banner_img_src() etc. defined in App controller.
On the other hand, in helpers.php I have stuff like:
Can someone share their opinion / examples / thoughts so I can feel more organized with what to put where in the future?
This question came up because I wanted to access certain functions defined in App.php from admin.php, and they were not accessible (tried even
use function on top…). And sometimes the other way around, wanted functions from, say, helpers.php to be available in a controller -> App.php (
use function on top worked here, for instance:
use function App\ha_get_acf_fields_key_name_map;). What I am doing wrong?