Skip to content

Commit

Permalink
another setting utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Jul 25, 2024
1 parent 2c55ca7 commit d5249ef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit d5249ef

Please sign in to comment.