outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
271 stars 98 forks source link

How to use nova_get_settings helper in other config files #95

Closed mikhi closed 2 years ago

mikhi commented 2 years ago

Hi,

It is possible to use nova_get_settings() outside nova? i.e. in other config files?

Thanks, Mihai

Tarpsvo commented 2 years ago

Hi!

It cannot be done inside config files because the settings are stored in MySQL and retrieving them requires querying the database.

The database connection info is inside the config files, so you would essentially be trying to query the database when the Laravel configuration service hasn't booted up yet.

The best you could do is modify the config inside AppServiceProvider boot() or register() methods.