-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typed property App\Settings\GeneralSettings::$name must not be accessed before initialization #18
Comments
Make sure you have namespace App\Settings;
use Spatie\LaravelSettings\Settings;
class GeneralSettings extends Settings
{
public string $name; // <-- You need to have this line
public static function group(): string
{
return 'general';
}
} |
@devscript-abdo, did @amrography solution solve the problem? If not, make sure you've migrated each property within your settings class. |
@rubenvanassche problem solved by define a default value for the $name : |
@devscript-abdo @rubenvanassche I'm having the same issue getting
|
There must be something wrong with mapping the properties from your database onto your settings class. Could you please check for typo's. We do unregister all public properties when the class is constructed so they can be loaded when required. That's why the exception says that the property is not initialized. |
@rubenvanassche After i re-updated the value for the setting it issue seems to be fixed. Thanks. |
Make sure, if your settings are cached, you clear your cache.
|
Typed property App\Settings\GeneralSettings::$name must not be accessed before initialization
I got this problem when I use this settings Class in some different namespace
The text was updated successfully, but these errors were encountered: