PHP code example of outerweb / filament-layout-builder

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

    

outerweb / filament-layout-builder example snippets


use OuterWeb\FilamentLayoutBuilder\Filament\FilamentLayoutBuilder;

class FilamentPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugins([
                FilamentLayoutBuilderPlugin::make(),
            ]);
    }
}

namespace App\View\Components\LayoutBuilder;

use Outerweb\FilamentLayoutBuilder\View\Components\Block;

class Article extends Block
{
    // ...
}

class Article extends Block
{
    protected string $view = 'components.layout-builder.article';
}

class Article extends Block
{
    // ...

    public function schema(): array
    {
        return [
            // ...
        ];
    }
}

class Article extends Block
{
    // ...

    public function formatData(array $data): array
    {
        $data['images'] = Image::whereIn('id', $data['images'] ?? [])->get();

        return $data;
    }
}