chrisffm
312
14
Laravel

Laravel Global Helper Functions not working

Posted 6 months ago by chrisffm

Hey there,

I am pretty new to Laravel and try to use the "asset" method, one of the helper functions which come with Laravel. But when I use the function, e.g. "echo asset('storage/file.txt');", I get the following error: "PHP Fatal error: Uncaught Error: Call to undefined function asset() in /Users/...."

However, when I click on the function in my IDE, I get redirected to the "asset" function in the helpers.php file in the "vendor/laravel/framework/src/Illuminate/Foundation" directory. Also the helpers.php is specified in the framework's autoload in "vendor/laravel/framework/composer.json".

Is there something I am missing like importing the functions? When looking in the global helper function documentation of Laravel, they use the functions right away.

Best, Christian

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.