Skip to content

Commit c13b833

Browse files
committed
Update docs to include default values
1 parent d669aa2 commit c13b833

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ You should migrate your database to add the properties:
256256
php artisan migrate
257257
```
258258

259+
Without the migration, if you try to load the `GeneralSettings` settings class, it will throw `MissingSettings` exception. To avoid this, you can define default values for each attribute. This can be useful if you have long-running migrations.
260+
261+
```php
262+
// Will throw an error
263+
public ?string $site_name;
264+
// Will return `null`
265+
public ?string $site_description = null;
266+
// Will return `false`
267+
public bool $site_active = false;
268+
```
269+
259270
Now, when you want to use the `site_name` property of the `GeneralSettings` settings class, you can inject it into your application:
260271

261272
```php

0 commit comments

Comments
 (0)