定制 zeeshantariq/filament-attachmate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

zeeshantariq/filament-attachmate

Composer 安装命令:

composer require zeeshantariq/filament-attachmate

包简介

Implement a polymorphic morphMany relationship for managing attachments within Filament

README 文档

README

Latest Version on Packagist Total Downloads License

This package provides attachment management using a polymorphic morphMany relationship within Filament. The system allows for the seamless association of attachments with various models, enabling flexible and efficient handling of file attachments across your application.

Filament Attachmate

Installation

You can install the package via composer:

composer require zeeshantariq/filament-attachmate

Filament version compatibility

Use the package version that matches your Filament major version:

  • Filament v3: ^1.1 (e.g. v1.1.1)
  • Filament v4: ^1.2 (starting from v1.2.0)
  • Filament v5: ^1.2 (starting from v1.2.0)

Examples:

# Filament v3
composer require zeeshantariq/filament-attachmate:^1.1

# Filament v4 or v5
composer require zeeshantariq/filament-attachmate:^1.2

The package comes with publishable assets:

Migrations

php artisan vendor:publish --tag="filament-attachmate-migrations"

Configuration

  1. Create your model
php artisan make:model MyModel
  1. Configure your model to handle morphMany attachments
use ZeeshanTariq\FilamentAttachmate\Core\InteractsWithAttachments;
// ...

class MyModel extends Model
{
    use InteractsWithAttachments;
    
    // ...
}
  1. Configure the Filament resource
  • In your form Filament resource declaration you need to add AttachmentFileUpload::make() so your users can upload the attachments.
use ZeeshanTariq\FilamentAttachmate\Forms\Components\AttachmentFileUpload;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            // ...

            AttachmentFileUpload::make(),
        ]);
}
  1. Configure the Filament resource The last configuration needed, is to add HandleAttachmets trait to the CreateRecord components of your model

CreateRecord component

use ZeeshanTariq\FilamentAttachmate\Core\HandleAttachments;

class CreateMyModel extends CreateRecord
{
    use HandleAttachments;

    // ...
}
  1. Configure the Filament resource The last configuration needed, is to add HandleAttachmets trait to the EditRecord components of your model

EditRecord component

use ZeeshanTariq\FilamentAttachmate\Core\HandleAttachments;

class EditMyModel extends EditRecord
{
    use HandleAttachments;

    // ...
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固