定制 benjaminhansen/filament-draftable 二次开发

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

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

benjaminhansen/filament-draftable

最新稳定版本:v1.0.5.2

Composer 安装命令:

composer require benjaminhansen/filament-draftable

包简介

Provides a draftable interface to save long forms as a draft in the browser's localStorage and encrypts the data using Laravel's encryption.

README 文档

README

Provides a Draftable trait that you can add to your Resource pages to allow saving data as a draft. All data is stored in your browser's localStorage and is encrypted using Laravel's encryption.

Installation

Install the package via composer:

composer require benjaminhansen/filament-draftable

Usage

<?php

namespace App\Filament\Resources\PostResource\Pages;

use BenjaminHansen\FilamentDraftable\Traits\Draftable;
use Filament\Resources\Pages\CreateRecord;

class CreatePost extends CreateRecord
{
    use Draftable;

    // add exclusions to this array to prevent them from being saved in the draft
    public ?array $excludeFromDraft = ['password'];

    // add/modify this method
    protected function getFormActions(): array
    {
        return [
            // load the existing/default form actions
            ...parent::getFormActions(),

            // append the draftable actions
            // we can use all of Filament's Action methods to customize the draftable actions
            $this->saveDraftAction(),
                // ->icon('')
                // ->label('')

            $this->loadDraftAction(),
                // ->icon('')
                // ->label('')

            $this->deleteDraftAction(),
                // ->icon('')
                // ->label('')
                // ->requiresConfirmation()
        ]
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-29