van-ons/laravel-attachment-library 问题修复 & 功能扩展

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

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

van-ons/laravel-attachment-library

最新稳定版本:v1.1.0

Composer 安装命令:

composer require van-ons/laravel-attachment-library

包简介

A Laravel library for attaching files to Eloquent models.

README 文档

README

Social card of Laravel Attachment Library

Laravel Attachment Library

Latest version on GitHub Total downloads GitHub issues License

A Laravel library for attaching files to Eloquent models.

Quick start

Installation

The Laravel Attachment Library can be installed using Composer by running the following command:

$ composer require van-ons/laravel-attachment-library

After downloading the dependency, run the following command to install all the migrations and assets:

$ php artisan attachment-library:install 

Usage

To enable file attachments in your Eloquent models, add the HasAttachments trait to your model class:

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use VanOns\LaravelAttachmentLibrary\Concerns\HasAttachments;

class ModelName extends Model
{
    use HasAttachments;
    
    // ...
}

After that you should be able to link attachments to your model as follows:

// Retrieve attachment.
$attachment = \VanOns\LaravelAttachmentLibrary\Models\Attachment::find($attachmentId);

// Retrieve your model.
$myModel = ModelName::find($modelId);

// Link attachment to your model.
$myModel->attachments()->attach($attachment);

Documentation

Please see the documentation for detailed information about installation and usage.

Contributing

Please see contributing for more information about how you can contribute.

Changelog

Please see changelog for more information about what has changed recently.

Upgrading

Please see upgrading for more information about how to upgrade.

Security

Please see security for more information about how we deal with security.

Credits

We would like to thank the following contributors for their contributions to this project:

License

The scripts and documentation in this project are released under the MIT License.

Logo of Van Ons

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-22