Documents
Description
Documents is a Laravel Enso package designed for advanced document management. It allows administrators to define document categories, types, and custom fields, providing a structured way to attach files to people (profiles).
The package integrates with Enso's file management system and includes support for data imports, making it easy to seed or migrate document structures and records.
Installation
Install the package:
composer require laravel-enso/documents
Run the package migrations:
php artisan migrate
Features
- Document Type Administration: Full CRUD for managing document categories and types.
- Custom Fields: Define specific fields for each document type to capture additional metadata.
- Profile Integration: Link documents directly to
Personmodels (profiles). - File Management: Leverages
laravel-enso/filesfor secure and efficient file storage. - Data Import Support: Includes importers for document types and fields.
- Table Integration: Ships with table builders for document browsing and administration.
Usage
Models
LaravelEnso\Documents\Models\Document: The main model representing an attached document.LaravelEnso\Documents\Models\DocumentType: Defines the structure and properties of a document type.LaravelEnso\Documents\Models\DocumentTypeCategory: Groups document types for better organization.LaravelEnso\Documents\Models\DocumentTypeField: Custom fields associated with a document type.
Enums
LaravelEnso\Documents\Enums\Field: Defines the available types for document custom fields (Numeric, Data, Checkbox, String, Select).
Relationships
A Document belongs to a Person (profile), a DocumentType, and a File.
$document->person;
$document->type;
$document->file;
API
Routes
All package routes are registered under:
- prefix:
api/ - middleware:
api,auth,core
Document Types Administration
GET /api/administration/documentTypes- Table dataGET /api/administration/documentTypes/create- Create formPOST /api/administration/documentTypes- Store new typeGET /api/administration/documentTypes/{documentType}/edit- Edit formPATCH /api/administration/documentTypes/{documentType}- Update typeDELETE /api/administration/documentTypes/{documentType}- Delete type
Documents
GET /api/documents/initTable- Initialize documents tableGET /api/documents/tableData- Fetch documents dataGET /api/documents/exportExcel- Export documents to ExcelGET /api/documents/options- Selectable document options
Depends On
Required Enso packages:
laravel-enso/corelaravel-enso/fileslaravel-enso/peoplelaravel-enso/data-importlaravel-enso/tableslaravel-enso/track-who
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!