PHP code example of wotz / filament-brigada-cms

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

    

wotz / filament-brigada-cms example snippets


use Wotz\FilamentBrigadaCms\Providers\BrigadaPanelProvider;

class AdminPanelProvider extends BrigadaPanelProvider
{
    protected function id(): string
    {
        return 'admin';
    }
}

use Wotz\FilamentBrigadaCms\Filament\Concerns\HandlesDraftsOnEdit;

class EditPage extends EditRecord
{
    use HandlesDraftsOnEdit;   // Publish, Save to new draft, Version switcher
}

use Oddvalue\LaravelDrafts\Concerns\HasDrafts;
use Wotz\FilamentBrigadaCms\Models\Concerns\HandlesTranslatableDrafts;

class Page extends Model
{
    use HandlesTranslatableDrafts {
        HandlesTranslatableDrafts::getDraftableAttributes insteadof HasDrafts;
    }
    use HasDrafts;
}

Schema::table('pages', fn (Blueprint $table) => $table->drafts());

class EditPage extends EditRecord
{
    use HandlesDraftsOnEdit;
    use HasLivePreviewComponent;   // from wotz/filament-live-preview

    protected function getHeaderActions(): array
    {
        return [
            ...$this->getDraftHeaderActions(),
            // your own actions after these
            DeleteAction::make(),
        ];
    }

    protected function getPreviewModalView(): ?string
    {
        return 'page.show';
    }

    protected function getPreviewModalDataRecordKey(): ?string
    {
        return 'page';
    }
}

class CreatePage extends CreateRecord
{
    use HandlesDraftsOnCreate;
    use HasLivePreviewComponent;

    protected function getHeaderActions(): array
    {
        return [
            ...$this->getDraftHeaderActions(),
            $this->getCancelFormAction(),
        ];
    }

    // getPreviewModalView() and getPreviewModalDataRecordKey() as above
}

protected function plugins(): array
{
    $plugins = parent::plugins();
    unset($plugins['live-preview'], $plugins['peek']);

    return $plugins;
}

protected function plugins(): array
{
    // Keyed, so you can reconfigure one without rebuilding the list.
    $plugins = parent::plugins();
    $plugins['shield']->navigationGroup(NavigationGroup::General);

    return [...$plugins, 'live-preview' => LivePreviewPlugin::make()];
}

protected function userMenuItems(): array
{
    return [...parent::userMenuItems(), Action::make('maintenanceMode')…];
}

'acronyms' => [..., 'bc', 'btw', 'kkg', 'ogm'],
bash
php artisan vendor:publish --tag=filament-brigada-cms-config