I saw some questions about, people say to run this command
ln -s ../storage/app/public public/storage
And it works, it copies the folder, but it doesn’t update when another file/image is added to the storage folder, you have to run the command again to be able to get it.
How do I make it equal to Laravel, that the public folder is always ‘copying’ the storage files?
Version: "laravel/lumen-framework": "^8.3.1",
"league/flysystem": "1.1"
2
Answers
First, make sure the
storage/app/public
folder exists. if not, please create a new one.Then run:
Then, move files at
storage/app/public
Now you should be able to access assets like this:
`
Lumen/Laravel way to create symlink:
updated. Create a command example:
then next file will be created:
app/Console/Commands/FilesLinkCommand.php
Open it and change some thingth:
better command signature:
protected $signature = 'files:link';
command description:
protected $description = 'Create symlink link for files';
command code, update method handle():
That’s all we need!
Using:
php artisan files:link
If command run first time you will see message
Symlink created
, next time it will be changed toSymlink exists!
php function symlink() can do the same