From 4e20665c62ef8dc81430adbcaed0f9a128cef6fa Mon Sep 17 00:00:00 2001 From: mf16 Date: Fri, 29 Mar 2019 17:28:02 -0600 Subject: [PATCH 1/2] Added default optional parameter --- src/Helpers/Configuration.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Helpers/Configuration.php b/src/Helpers/Configuration.php index d9e4536..5b1855c 100755 --- a/src/Helpers/Configuration.php +++ b/src/Helpers/Configuration.php @@ -15,12 +15,12 @@ class Configuration extends Model * @param $key * @return mixed */ - public static function get($key) + public static function get($key, $default = null) { $line = self::getElementByKey($key); if(is_null($line)){ - return null; + return $default; } return $line->value; @@ -80,4 +80,4 @@ public static function setById($id, $key, $value) return true; } -} \ No newline at end of file +} From 32f5ede835b99405c5f36e6fca522fded40f6e2d Mon Sep 17 00:00:00 2001 From: mf16 Date: Fri, 29 Mar 2019 17:29:31 -0600 Subject: [PATCH 2/2] Updated README w/ optional params --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 30dcf99..57e08a4 100644 --- a/README.md +++ b/README.md @@ -54,13 +54,13 @@ And then just you have to manipulate the settings. ```php - -// Get the value of the API_GOOGLE key, null if it doesn't exist - use Inani\LaravelNovaConfiguration\Helpers\Configuration; +// Get the value of the API_GOOGLE key, null if it doesn't exist $value = Configuration::get('API_GOOGLE'); +// Get the value of the FOO key, 'BAR' if it doesn't exist +$value = Configuration::get('FOO', 'BAR); ``` #### Updating the sidebar bar label