Change Laravel directory /directory 8

Asked

Viewed 301 times

2

I’m in trouble, using LARAVEL 8 and Voyager installed. When logging in via SSH on my shared server I am in "public", its going down a level I go to "meusite.com.br" here upei all the files and directories of Laravel that in example has this structure:

 /app
 /storage
 ../public/index.php
 /outros

In that ssh nay I have access to php cli to run "php Artisan make:link" So I need to create a symbolic link from the "Storage" folder to the "public" folder with the command: ln -s /Storage /public But the "ln" command also nay is recognized in the ssh of the umbler. As a solution I thought of creating the directory Storage inside the public. Does anyone know if it is possible?. If yes how to do. If not, another suggested solution?

  • Worked ? ...

  • @novic Your tip worked, my system is now picking up the images from the new directory which is an exact copy of the previous one and is also saving the new images correctly. However I am afraid as follows: My new entry in filesystems.php looks like this: 'newstorage' => [ 'driver' => 'local' 'root' => public_path('newstorage/app/public'), 'url' => env('APP_URL'). '/newstorage/app/public', 'visibility' => 'public', ];'

  • @novic Your tip worked, my system is now picking up the images from the new directory which is an exact copy of the previous one and is also saving the new images correctly. Follow the code: 'newstorage' => [
 'driver' => 'local'
 'root' => public_path('newstorage/app/public'),
 'url' => env('APP_URL').'/newstorage/app/public',
 'visibility' => 'public',
 ];
 However I am a little afraid of this solution that I will describe in another question, because this I will mark as resolved if you can help me there thank you. Thank you!

1 answer

2


Yes it is possible to change the recording location of your images to the folder public, open the folder file config by the name of filesystems.php and create an entry in array disks by the name of Storage and follow the example:

'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],
        
        'storage' => [
            'driver' => 'local'
            'root' => public_path('storage'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ];

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
        ],

    ],

Remarks: can be any name, the settings are those the helper public_path and the folder public of your project and the name within storage is the name of the folder inside the folder public, actually another entry was created to record and recover files in a particular folder.


Reference: File Storage

Browser other questions tagged

You are not signed in. Login or sign up in order to post.