UploadManagerthen we might also create a
UploadS3Driverwhich will be able to upload to both the file system (disk) and Amazon S3. In the future if we have to upload to Microsoft Azure or Google Cloud Storage then we simply create new drivers like
UploadGoogleDriverwhich are very simple to create. Drivers can be as small as a single method or have dozens of methods. The Manager Pattern makes it dead simple to expand the functionality of a Manager and add capabilities to Masonite's features.
masonite/drivers. For our
UploadDiskDriverwe will create the file:
UploadManager) will resolve the constructor of this driver. This basically means that anything we put in our constructor will be automatically injected into this driver. So for our purposes of this driver, we will need the storage and the application configuration.
store()method simply takes the file and write the contents of the
fileitemto the disk.
UploadProviderwill look like:
UploadXDriversthat are loaded into the container. So if we set the
DRIVERinside our configuration file to
UploadGoogleDriverinside our container. Read more about Managers in the About Managers documentation.