Using Local and Public Disks

Having vagrant run on Windows host machine may cause some problems with symbolic links. After trying to make symbolic links to work and failing, I decided to use public disk in development and local disk in production.

php artisan storage:link makes symbolic link from “public/storage” to “storage/app/public”.  When developing on windows-vagrant this command will not work properly, however it works on the production Ubuntu server. The solution is not to run this command in development and swap local disk with public during development.

/* config/filesystems.php */
return [
    'default' => env('FILESYSTEM_DISC', 'local'),
    'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
        'public' => [
            'driver' => 'local',
            'root' => public_path('storage'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
# .env file in development
# .env file in production