Laravel: How to put access images into deployed project?
Hey everyone
Again and again I am encountering the same issue when deploying my project (DigitalOcean vps + Porkbun domain) - I don't see images that are stored in the ../storage/app/public/. Of course, it happening because all files in the ../storage/app/public/ are in the .gitignore file and when I am pushing my project to the origin main they are not in the repository
But I wanna to know, how can I achieve my files in the deployed project? I thought that I can include storage folder to the git once and get access to files, but it seems like there is a better option
(and of course I'll need to create a symbolik link using php artisan storage:key)
What is the problem? Why you can't just upload your images via FTP or whatever access you have?
It is good your storage folder is excluded from git project, binary assets should be separate. Imagine you have videos, not images - do you want your repo to be size of gigabytes?
If you want to deploy images along with the code and avoid manual uploading, you may for example create Artisan command which synchronizes your public directory with some dedicated assets storage (S3 maybe). Execute the command as last step of your deployment workflow and your images are up to date.
if these are static assets for the project then move them to a public/images folder. They will be in your repo also, so get deployed with your project.