I have a Laravel 5.3 project versioned, and files in this folder are constantly changing.
Is safe to remove from version control system?
If I delete that folder from my working copy, Laravel can keep working?
folder structure
The public_path() is a method Laravel uses to fetch the folder passed as a parameter to the path of the directory. The Storage facade grants access to the file system of the application so that the deleteDirectory() method can delete the specified directory.
One way to delete a file from the public directory in Laravel is to use the Storage facade. To delete a file, you will need to follow the following steps: Step 1: Check to ensure that the folder and file exist. Step 2: Delete the required file.
The storage directory contains your logs, compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This directory is segregated into app , framework , and logs directories. The app directory may be used to store any files generated by your application.
You'll notice in a default Laravel 5.3 install there are 3 folders within storage
. It looks like this:
+ storage
+ app
+ framework
+ logs
And each of those subfolders has a .gitignore
as well as other folders (also usually with gitignores
. Those .gitignore
files generally say to ignore all files except for the .gitignore
. For example, this is the .gitignore
inside storage/logs
:
*
!.gitignore
That means that you can keep this in version control, but any file written to that folder (except for the .gitignore
file itself) will NOT be in your git repository.
Also, it might help to know that these folders have a specific purpose:
app
: Designed to be used as storage for files outside of your root public folder
framework
: By defaut, this is where Laravel writes a lot of its files for cache and views
logs
: Where the error logs are written
If you delete the root storage
folder or these subfolders, the framework will have trouble finding these files and you'll get errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With