Using /images instead of /storage/images to upload files to local storage
With the default configuration, laravel uploads images to the public disk: storage/app/public/, when using the storage:link command, we get a symbolic link from public/storage to storage/app/public
There are 2 downsides with this approach:
to access files through the browser you use the url: yoursite.com/storage/path_to_file
you have to manually add the storage portion to your links
I'm doing something wrong?, Is there any "laravel way" of getting rid of the storage part?, I could change the storage configuration, I could store my images inside a folder (let's say logos), and then do a symbolic link from public/logos to storage/app/public/logos
The downside of this:
I have to remember this when somebody else installs the project in their computer (or add a new artisan command to do it) or when deploying.
Just configure root to upload to public_path() (or specifically where you want) instead of storage_path('app'). Then uploads will be placed directly in /public, and you can use the asset helpers without having to manually enter "storage" in the url.
When you use the FileUploader class they use the filestorage disks configured. By default they place the files on storage/app/public. That folder is not public to the world, so, laravel recommend doing a symbolic link from public/storage to storage/app/public.
I want to put a link from public/x to storage/app/public/x, I'm asking if laravel has some standard way of doing this, maybe an undocumented option on tinker, idk.
I want to put a link from public/x to storage/app/public/x, I'm asking if laravel has some standard way of doing this, maybe an undocumented option on tinker, idk.
The only link laravel makes out of the box is the default one you are trying not to use, after you run artisan storage:link. Of course, you can manually make a link in linux. I'm not sure the point though, going by your last post. Then instead of asset('storage/some-file.txt') you'll have asset('x/some-file.txt'). you'll have to manually enter x instead of storage.
If you just change the location of the uploads like I suggested originally, then you could just use asset('some-file.txt') which would be http://yoursite.com/some-file.txt which is what I thought you wanted (no mention of storage in the url).