php - How to call app_path() function in laravel lumen?
Get the solution ↓↓↓How to call app_path() function or to make a Helper for app_path() function in Laravel lumen? I need it because i got this error,.. "Call to undefined function app_path()" It has a package here for that,.. but is not supported for Laravel Lumen version 7 Anyone knows hot to make it?
thanks,.. sorry for my english,.
Answer
Solution:
I fixed the error now,.
i added this to myapp/Helpers/helpers.php
file.
<?php
if (!function_exists('app_path')) {
/**
* Get the path to the application folder.
*
* @param string $path
* @return string
*/
function app_path($path = '')
{
return app('path') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
}
for the other config.
dont forget to add this incomposer.json
file:
"autoload": {
"files": [
"app/Helpers/helpers.php"
]
},
and run this command:composer dump-autoload
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: malformed utf-8 characters, possibly incorrectly encoded
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.