I am brand new to Laravel and php and I noticed that there are two different folders that have public on them. One is public/storage
and the other is storage/app/public
, what is the difference between the both of them? Where should I be putting my files that I want to use like images and my CSS styles?
2 Answers
the public/storage
is just a symlink of storage/app/public
so both are the same,
The public disk is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores these files in storage/app/public. To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public. This convention will keep your publicly accessible files in one directory that can be easily shared across deployments when using zero down-time deployment systems like Envoyer.
To create the symbolic link, you may use the storage:link
Artisan command:
php artisan storage:link
Laravel provides excellent filesystems abstraction and it is very simple to use.
The public disk is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores these files in storage/app/public.
To create the symbolic link, you may use the storage:link Artisan command:
php artisan storage:link
When using the local driver, all file operations are relative to the root directory defined in your filesystems configuration file. By default, this value is set to the storage/app directory.
Here is link to documentation: https://laravel.com/docs/5.8/filesystem