diff --git a/app/helpers.php b/app/helpers.php index 9a598c80..d0de5b95 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,6 +1,7 @@ get($key, $default); + } catch (Exception $e) { + return $default; + } + + return $value; + } +} + +/* + * Shortcut for retrieving a KVP + */ +if (!function_exists('kvp_save')) { + /** + * Read a setting from the KVP repository + * + * @param string $key + * @param string $value + * + * @return mixed|null + */ + function kvp_save(string $key, string $value) + { + /** @var KvpRepository $kvpRepo */ + $kvpRepo = app(KvpRepository::class); + $kvpRepo->save($key, $value); + } +} + /* * Wrap the asset URL in the publicBaseUrl that's been * set