Replies: 2 comments
-
The whole point of the package is strongly typed settings, you would lose those with such a method, refactoring wouldn't work anymore, no IDE hints etc Writing: app(FooterSettings::class)->copyright Isn't that horrible in my opinion tbh. |
Beta Was this translation helpful? Give feedback.
-
It should be possible to create a custom helper function and/or Facade, of course. For example, there's a package Laravel Settings, started by Randall Wilk, that provides a helper function: if (! function_exists('settings')) {
function settings($key = null, $default = null, $context = null)
{ Source: src/helpers.php An example is provided in their documentation: // Store
Settings::set('foo', 'bar');
settings()->set('foo', 'bar');
settings(['foo' => 'bar']);
// Retrieving
Settings::get('foo'); // 'bar
settings()->get('foo');
settings('foo'); It's worth to note that they also mention Spatie's package on the same documentation page. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a reason why this package doesn't include an helper to get settings for example in blade views?
A common example: I have a
footer.copyright
setting for the text in footer.Beta Was this translation helpful? Give feedback.
All reactions