guava/filament-drafts
Composer 安装命令:
composer require guava/filament-drafts
包简介
A filament plugin that adds the ability to manage drafts and revisions of your models.
README 文档
README
Filament Drafts
This plugin adds the ability to manage your model's drafts and revisions in your filament resources.
It's a filament implementation for Laravel Drafts.
drafts-preview.mov
Installation
You can install the package with composer:
composer require guava/filament-drafts
Usage
Model Trait
First make sure that you have correctly set-up a model to use drafts from Laravel Drafts.
At the very least you need to add the HasDrafts (please note this is a modified trait) trait to your model:
use Guava\FilamentDrafts\Concerns\HasDrafts; class Post extends Model { use HasDrafts; }
and modify your migration:
return new class extends Migration { public function up(): void { Schema::create('posts', function (Blueprint $table) { //... $table->drafts(); }; } }
NOTE: If you use the HasDrafts trait from Laravel Drafts, make sure you have defined is_published in your $fillable properties.
After that, all you need to do is add a few traits to your resource and resource pages:
Resource Trait
Add the Draftable trait to your Resource:
use Guava\FilamentDrafts\Admin\Resources\Concerns\Draftable; class PostResource extends Resource { use Draftable; }
Resource Pages
Add the respective Draftable trait to your Resource Pages:
(Keep in mind that each page uses a different trait from another namespace)
Create Page
use Guava\FilamentDrafts\Admin\Resources\Pages\Create\Draftable; class CreatePost extends CreateRecord { use Draftable; }
Edit Page
use Guava\FilamentDrafts\Admin\Resources\Pages\Edit\Draftable; class EditPost extends EditRecord { use Draftable; }
List Page
use Guava\FilamentDrafts\Admin\Resources\Pages\List\Draftable; class ListPosts extends ListRecords { use Draftable; }
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
Other packages
guava/filament-drafts 适用场景与选型建议
guava/filament-drafts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.8k 次下载、GitHub Stars 达 75, 最近一次更新时间为 2023 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 guava/filament-drafts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 guava/filament-drafts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 75
- 点击次数: 9
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-10
