I’m looking for a way to store pages names so that I don’t have to keep referencing page('blog') in each of my controllers, as the page name called change from blog to notes as an example.
Can I store these inside my config or as a global variable somehow? I have seen answers covering using a function inside a plugin, but I’m not sure I want to go this route.
A config option is useful if the value isn’t changed by the user, e.g.
return [
'blogpage' => 'blog'
];
In controllers:
$blogPage = page(option('blogpage'));
That doesn’t help though if the page id can be changed in the Panel. In that case, it might be more useful to find the page by template (provided that the template cannot be changed) or by a unique ID.