Skip to content

Commit e063ff5

Browse files
authored
Setting::get( $key, $default = null )
Having possiblity to set default value on Setting::get
1 parent 2c1937b commit e063ff5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/Models/Setting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public function __construct(array $attributes = [])
2626
*
2727
* @return string The setting value.
2828
*/
29-
public static function get($key)
29+
public static function get($key, $default = null)
3030
{
3131
$setting = new self();
3232
$entry = $setting->where('key', $key)->first();
3333

3434
if (!$entry) {
35-
return;
35+
return $default;
3636
}
3737

3838
return $entry->value;

0 commit comments

Comments
 (0)