Laravel 5 change public_path()

In Laravel 5, you can change the value of the public_path() function by modifying the 'public' key in the config/filesystems.php configuration file.

Watch a course Learn object oriented PHP

For example, if you want to change the public_path() to /var/www/html/laravel/public:

'public' => [
        'driver' => 'local',
        'root' => '/var/www/html/laravel/public',
        'url' => env('APP_URL').'/public',
        'visibility' => 'public',
    ],

Make sure to clear the config cache after making changes by running the command php artisan config:clear