Documents Manager for Laravel Enso.
This package works exclusively within the Enso ecosystem.
There is a front end implementation for this this api in the accessories package.
For live examples and demos, you may visit laravel-enso.com
click on the photo to view a short demo in compatible browsers
Comes pre-installed in Enso.
- permits the management (upload, download, delete, show) of documents in the application
- can attach documents to any other model
- uses Files for file operations
- uses the ImageTransformer package for optimizing the uploaded image files
- security policies are used to enforce proper user authorization
- comes with a
Documentabletrait that can be quickly added to the model you want to give this functionality to
- offers various configuration options, including the option to delete all attached documents to a Documentable entity, when it gets deleted
- creates a
Documentmodel that has a
- polymorphic relationships are used, which makes it possible to attach documents to any other entity
- once documents are attached to an entity, you should not be able to delete the entity without deciding what you want to do with the associated documents. This is configurable in the options, see below
use Documentablein the Model that needs documents and import the trait. Then you'll have access to the
because users upload documents you can add
use Documentsto the User model. This trait will set the relationship between users and the documents that they create
Documentsvue component and use it in your pages/components, see the front end implementation docs for the available options
Since this package is using image processing libraries and these underlying libraries may use a lot of memory,
especially if the processed files are large (for example, for an 8MB image file, more than 128MB of memory might be used ),
make sure to configure php accordingly and/or do
Failure to do so may result in silent errors if allotted memory is insufficient.
config/enso/documents.php configuration file, lets you customize the following:
deletableTimeLimit- the time limit for deleting an uploaded document, in seconds. Default is
60 * 60(1 hour)
linkExpiration, - the time limit for document share link, in seconds. Default is
60 * 60 * 24(1 day)
imageWidth- the image width, in pixels, used when resizing bigger picture files. Default is
imageHeight- the image height, in pixels, used when resizing bigger picture files. Default is
onDelete, string, option that manages the case when the commentable entity is deleted and it has attached addresses. Valid options are
restrict| default is
With the cascade option, when a commentable model is deleted, the comments attached to it are also deleted. With the restrict option, when attempting to delete a commentable model with attached comments, an exception is thrown.
loggableMorph, the list of entities using the commentable functionality, each mapped to its respective loggable attribute For example:
'commentable' => [ Company::class => 'name', ],
This configuration is used for activity logging.
php artisan vendor:publish --tag=documents-config- configuration file
php artisan vendor:publish --tag=enso-config- a common alias for when wanting to update the config, once a newer version is released, usually used with the
are welcome. Pull requests are great, but issues are good too.
This package is released under the MIT license.