laravel-enso/documents 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laravel-enso/documents

Composer 安装命令:

composer require laravel-enso/documents

包简介

Documents Manager for Laravel Enso

README 文档

README

License Stable Downloads PHP Issues Merge Requests

Description

Documents adds polymorphic document attachments to Enso models.

The package stores uploaded documents through the Enso files layer, exposes document listing, upload, and delete endpoints, supports configurable deletion rules for related models, and can queue OCR for PDF documents whose owners implement the Ocrable contract.

It is meant for backoffice models that need a lightweight document vault with optional OCR processing.

Installation

Install the package:

composer require laravel-enso/documents

Run the package migrations:

php artisan migrate

Optional publish:

php artisan vendor:publish --tag=documents-config

Default configuration:

return [
    'deletableTimeLimit' => 60 * 60,
    'imageWidth' => 2048,
    'imageHeight' => 2048,
    'onDelete' => 'restrict',
    'loggableMorph' => [
        'documentable' => [],
    ],
    'queues' => [
        'ocr' => 'heavy',
    ],
];

Features

  • Polymorphic one-to-one and one-to-many document relations via the Documentable trait.
  • File attachment handling through laravel-enso/files.
  • Upload, list, and delete API under core.documents.
  • Configurable delete policy with restrict or cascade.
  • OCR dispatch for PDF documents whose owner implements Ocrable.

Usage

Add the trait to any model that should own documents:

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Documents\Traits\Documentable;

class Order extends Model
{
    use Documentable;
}

Available relations:

  • document()
  • documents()

If the owning model should trigger OCR for uploaded PDFs, implement LaravelEnso\Documents\Contracts\Ocrable.

API

HTTP routes

  • GET api/core/documents
  • POST api/core/documents
  • DELETE api/core/documents/{document}

Route names:

  • core.documents.index
  • core.documents.store
  • core.documents.destroy

Model surface

LaravelEnso\\Documents\\Models\\Document

Useful methods:

  • store(array $request, array $files)
  • scopeFor(array $params): Builder
  • scopeFilter(?string $search): Builder

Depends On

Required Enso packages:

Companion frontend package:

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

统计信息

  • 总下载量: 40.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 6
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固