PHP code example of alexspi / filament-site-designer

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

    

alexspi / filament-site-designer example snippets


use Alexspi\FilamentSiteDesigner\FilamentSiteDesignerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            FilamentSiteDesignerPlugin::make()
                ->navigationGroup('Design')
        );
}

'integrations' => [
    'site_setting_class' => \App\Models\SiteSetting::class, // or null
    'post_model_class' => \App\Models\Post::class,           // or null
    'post_route' => 'blog.show',
],

'front' => [
    'template_map' => [
        \App\Livewire\HomePage::class => 'home',
        \App\Livewire\BlogShow::class => 'post_show',
    ],
    'preview_urls' => [
        'home' => '/',
        'blog_index' => '/blog',
        'post_show' => '/blog',
        'page_show' => '/',
    ],
],

'preview' => [
    'brand_resolver' => fn (): array => [/* name, logo, tagline, footer */],
    'posts_resolver' => fn (int $limit): array => [/* preview rows */],
    'post_url_resolver' => fn (): ?string => url('/blog/example'),
],

use Alexspi\FilamentSiteDesigner\Support\SiteDesign;

// In layout <head>:
{!! SiteDesign::cssVariablesStyle() !!}

SiteDesign::zone('header');
SiteDesign::enabledBlocks('post_show');
SiteDesign::contentLayoutClass();
SiteDesign::frontTemplateKey(); // needs front.template_map

namespace App\Support;

use Alexspi\FilamentSiteDesigner\Support\SiteDesign as PackageSiteDesign;

class SiteDesign extends PackageSiteDesign
{
    // host-only overrides if needed
}
bash
php artisan vendor:publish --tag=filament-site-designer-config
php artisan vendor:publish --tag=filament-site-designer-assets
php artisan migrate
bash
php artisan vendor:publish --tag=filament-site-designer-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=filament-site-designer-assets --force
bash
php artisan vendor:publish --tag=filament-site-designer-views