PHP code example of ronssij / filament-simple-draft
1. Go to this page and download the library: Download ronssij/filament-simple-draft 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/ */
use Ronssij\FilamentSimpleDraft\Contracts\CanBePublished;
use Ronssij\FilamentSimpleDraft\Publishable;
class User extends Authenticatable implements CanBePublished
{
// Optionally, you can set you published column identifier
// Or you can set it via configuration (config/filament-simple-draft.php).
protected ?string $publishColumn = 'published_date';
use Publishable;
}
use Filament\Resources\Pages\EditRecord;
use Ronssij\FilamentSimpleDraft\Pages\Traits\Edit\Draftable;
class EditUser extends EditRecord
{
use Draftable;
}
use Filament\Resources\Pages\CreateRecord;
use Ronssij\FilamentSimpleDraft\Pages\Traits\Create\Draftable;
class CreateUser extends CreateRecord
{
use Draftable;
}
use Filament\Forms;
use Filament\Forms\Form;
use FilamentTiptapEditor\Enums\TiptapOutput;
use FilamentTiptapEditor\TiptapEditor;
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->label('Blog title')
->draftable()
Forms\Components\Textarea::make('description')
->label('Blog description')
->rows(5)
->draftable()
TiptapEditor::make('content')
->label('Blog content')
->draftable()
->output(TiptapOutput::Html)
]);
}