PHP code example of guava / filament-drafts

1. Go to this page and download the library: Download guava/filament-drafts 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/ */

    

guava / filament-drafts example snippets


use Guava\FilamentDrafts\Concerns\HasDrafts;

class Post extends Model
{
    use HasDrafts;
}

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('posts', function (Blueprint $table) {
            //...
            $table->drafts();
        };
    }
}

use Guava\FilamentDrafts\Admin\Resources\Concerns\Draftable;

class PostResource extends Resource
{
    use Draftable;
}

use Guava\FilamentDrafts\Admin\Resources\Pages\Create\Draftable;

class CreatePost extends CreateRecord
{
    use Draftable;
}

use Guava\FilamentDrafts\Admin\Resources\Pages\Edit\Draftable;

class EditPost extends EditRecord
{
    use Draftable;
}

use Guava\FilamentDrafts\Admin\Resources\Pages\List\Draftable;

class ListPosts extends ListRecords
{
    use Draftable;
}