Public folder means files will be publicly accessible. For example an image stored in public/images/my-image.jpeg
can be viewed by anyone by going to
mysite.com/images/my-image.jpeg
However, files stored in storage
directory are only available to your app.
Laravel has a php artisan storage:link
command that adds a symlink to public
from storage/app/public
The reason for this is that your storage
may not be your local filesystem, but rather an Amazon S3 bucket or a Rackspace CDN (or anything else)
You will need to setup your filesystem configurations by following the docs https://laravel.com/docs/5.6/filesystem
Once this is done you can get/store files to/from the storage place rather than have everything on your server.
There are 2 helper methods for public
and storage
to show files:
storage: storage_path('my-file.jpg')
public: asset('my-file.jpg')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…