PHP code example of softok2 / filament-page-builder

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

    

softok2 / filament-page-builder example snippets


class HomeBlock extends PageBlock
{
    const HEADER_SECTION = 'header_section';

    public static string $fileUploadDirectory = 'uploads/pages/';

    public function headerSection(): Block
    {
        return Block::make(self::HEADER_SECTION)->label(__('Header Section'))
            ->schema([
                Text::make('title'),
                ImageUpload::make('background'),
            ])->maxItems(1);
    }
}

...
   ->plugins([
        FilamentPageBuilder::make()
])

FilamentPageBuilder::make()
            ->withPosts()
            ->blocksMapper([
                'history' => HistoryBlock::class,
            ])
            ->layoutsComponentsMapper([
                'hero' => HeroComponent::class,
            ])
bash
php artisan filament-page-builder:install
bash
php artisan migrate --seed
bash
php artisan filament-page-builder-lc:make HeroComponent