From 7ff450533093274590f051099e5719f76339fab1 Mon Sep 17 00:00:00 2001 From: Pete Bishop <9081809+PeteBishwhip@users.noreply.github.com> Date: Thu, 8 May 2025 09:54:10 +0100 Subject: [PATCH] Add documentation for new closure support --- resources/views/docs/desktop/1/the-basics/settings.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/views/docs/desktop/1/the-basics/settings.md b/resources/views/docs/desktop/1/the-basics/settings.md index f738b01e..01bde91d 100644 --- a/resources/views/docs/desktop/1/the-basics/settings.md +++ b/resources/views/docs/desktop/1/the-basics/settings.md @@ -27,11 +27,16 @@ To retrieve a setting, use the `get` method. $value = Settings::get('key'); ``` -You may also provide a default value to return if the setting does not exist. +You may also provide a default value to return if the setting does not exist. You can provide either a static default value, or a closure: ```php $value = Settings::get('key', 'default'); ``` -If the setting does not exist, `default` will be returned. +```php +$value = Settings::get('key', function () { + return 'default'; + }); +``` +If the setting does not exist, and no default value is provided, `null` will be returned. ### Forgetting a value If you want to remove a setting altogether, use the `forget` method.