Create a file called helpers.php
in the app/
directory. Paste the code inside it.
Go to composer.json
and add files
to autoload
so that it looks like this:
"autoload": {
"psr-4": {
"App\\": "app/"
},
"files": [
"app/helpers.php"
]
},
Run composer dump-autoload
to load the newly created helpers file.
public static function config()
{
if (!function_exists('config_path')) {
function config_path($path = '')
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}
}