From d5249ef429756efbb45881bd4b59ca01c69760d9 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 25 Jul 2024 17:07:19 +0800 Subject: [PATCH] another setting utility method --- src/Models/Setting.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Models/Setting.php b/src/Models/Setting.php index 801b6f8..5960a04 100644 --- a/src/Models/Setting.php +++ b/src/Models/Setting.php @@ -244,6 +244,21 @@ public static function lookupFromCompany(string $key, $defaultValue = null) return static::lookup('company.' . session('company') . '.' . $key, $defaultValue); } + /** + * Alias for `lookupFromCompany' + * Retrieves a setting specific to a company from the session context. If the company identifier is not + * available in the session, it returns the default value. + * + * @param string $key the setting key associated with a company + * @param mixed|null $defaultValue the default value to return if the setting or company is not found + * + * @return mixed returns the value of the setting if found, or the default value if not + */ + public static function lookupCompany(string $key, $defaultValue = null) + { + return static::lookupFromCompany($key, $defaultValue); + } + /** * Retrieve a specific setting record by its key. *