benjaminhansen / filament-draftable
Provides a draftable interface to save long forms as a draft in a browser cookie.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.2
- filament/filament: ^3.0
- laravel/helpers: ^1.7
Requires (Dev)
- laravel/pint: ^1.22
README
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']; // set how long the cookie should be valid for public ?int $saveDraftFor = 3600; // 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('') ] } }