Search code examples
phplaravellaravel-5

Laravel 5 change public_path()


I am trying to move the public folder to other place. However, I can't find the place to modify public_path() variable. Now, the 'public_path()' return the wrong path of folder.

Where can I set the variable for public_path()?


Solution

  • You can override the public path using ioc container :

    What worked for me flawlessly was adding to public/index.php the following three lines:

     $app->bind('path.public', function() {
        return __DIR__;
    });
    

    For more detailed explanation click here