Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting undefined function public_path() error in lumen

Tags:

laravel

lumen

I am trying to upload image in lumen. I got some examples and when i tried to implement it, got below error <!-- Call to undefined function App\Http\Controllers\public_path() (500 Internal Server Error) -->

Just want to confirm is this function got changed or do i need to include helper file.

Thanks

like image 795
Alankar Avatar asked Sep 05 '25 16:09

Alankar


1 Answers

Many of Laravel helpers don't exist in Lumen including public_path() and storage_path() you can include both methods in your Lumen project by creating a helpers.php file in your App directory or wherever you want and autoload that file in your composer.json files like so

"autoload": {
   "files": [
      "app/helpers.php"
   ],
   ....
  }
},

Don't forget to run composer dump-autoload

like image 168
mmabdelgawad Avatar answered Sep 07 '25 10:09

mmabdelgawad