PHP code example of benjaminhansen / filament-draftable
1. Go to this page and download the library: Download benjaminhansen/filament-draftable library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
benjaminhansen / filament-draftable example snippets
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('')
// ->