Skip to content

Commit

Permalink
fix: update condition for functions that conflict with laravel framework
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 4, 2023
1 parent b6c1ef4 commit b41efea
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions common/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,38 @@ function tgn_convert_action_name(string $action): string
}
}

if (!function_exists('config')) {
/**
* Return config value by string
*
* @param string $string
*
* @return mixed
*/
function config(string $string): mixed
{
return (new ConfigHelper())->execConfig($string);
if (!class_exists('Illuminate\Foundation\Application')) {
if (!function_exists('config')) {
/**
* Return config value by string
*
* @param string $string
*
* @return mixed
*/
function config(string $string): mixed
{
return (new ConfigHelper())->execConfig($string);
}
}
}

if (!function_exists('view')) {
/**
* Get view template
*
* @param string $partialPath
* @param array $data
*
* @return null|string
*/
function view(string $partialPath, array $data = []): null|string
{
$content = (new ConfigHelper())->getTemplateData($partialPath, $data);
return $content ?: null;
if (!function_exists('view')) {
/**
* Get view template
*
* @param string $partialPath
* @param array $data
*
* @return null|string
*/
function view(string $partialPath, array $data = []): null|string
{
$content = (new ConfigHelper())->getTemplateData(
$partialPath,
$data
);

return $content ?: null;
}
}
}

0 comments on commit b41efea

Please sign in to comment.