PHP code example of tomatophp / filament-cms

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

    

tomatophp / filament-cms example snippets


->plugin(
    \TomatoPHP\FilamentCms\FilamentCMSPlugin::make()
        ->useCategory()
        ->usePost()
        ->allowExport()
        ->allowImport()
)

->plugin(\TomatoPHP\FilamentCms\FilamentCMSPlugin::make()->allowYoutubeImport())

->plugin(\TomatoPHP\FilamentCms\FilamentCMSPlugin::make()->allowBehanceImport())

use TomatoPHP\FilamentCms\Facades\FilamentCMS;
use TomatoPHP\FilamentCms\Services\Contracts\CmsType;

public function boot()
{
    FilamentCMS::types()->register([
        CmsType::make('building')
            ->label('Buildings')
            ->icon('heroicon-o-home')
            ->color('danger')
    ]);
}


use TomatoPHP\FilamentCms\Facades\FilamentCMS;
use TomatoPHP\FilamentCms\Services\Contracts\CmsAuthor;

public function boot()
{
    FilamentCMS::authors()->register([
        CmsAuthor::make('Admin')
            ->model(\App\Models\User::class)
    ]);
}




return [
    /*
     * ---------------------------------------------------
     * Allow Features
     * ---------------------------------------------------
     */
    "features" => [
        "theme-manager" => true,
    ],
];

->plugin(\TomatoPHP\FilamentCms\FilamentCMSPlugin::make()->useThemeManager())

->plugin(\TomatoPHP\FilamentCms\FilamentCMSPlugin::make()->usePageBuilder())

use TomatoPHP\FilamentCms\Services\Contracts\Section;
use TomatoPHP\FilamentCms\Facades\FilamentCMS;
use Filament\Forms\Components\TextInput;

FilamentCMS::themes()->register([
    Section::make('hero')
        ->label('Hero Section')
        ->view('sections.pages.hero')
        ->form([
            TextInput::make('title')
                ->label('title'),
            TextInput::make('description')
                ->label('description'),
            TextInput::make('url')
                ->url()
                ->label('url'),
            TextInput::make('button')
                ->label('button'),
        ])
]);


use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    $page = load_page('/');
    return view('welcome', compact('page'));
});


use TomatoPHP\FilamentCms\Services\FilamentCMSFormFields;
use TomatoPHP\FilamentCms\Services\Contracts\CmsFormFieldType;

FilamentCMSFormFields::register([
    CmsFormFieldType::make('code')
        ->className(CodeEditor::class)
        ->color('warning')
        ->icon('heroicon-s-code-bracket-square')
        ->label('Code Editor'),
]);

use TomatoPHP\FilamentCms\Services\FilamentCMSFormBuilder;

FilamentCMSFormBuilder::make('xvssd')->build()

use TomatoPHP\FilamentCms\Services\FilamentCMSFormBuilder;

FilamentCMSFormBuilder::make('xvssd')->send($data)

use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;

    // ...
}

->plugin(\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make())

->plugin(\TomatoPHP\FilamentCms\FilamentCMSPlugin::make()->allowShield())

\TomatoPHP\FilamentCms\Events\PostCreated::class
\TomatoPHP\FilamentCms\Events\PostUpdated::class
\TomatoPHP\FilamentCms\Events\PostDeleted::class
bash
php artisan filament-cms:install
bash
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
php artisan migrate
bash
php artisan dusk:install
bash
composer dump-autoload
bash
php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan filament-cms:theme
bash
php artisan shield:install
bash
php artisan vendor:publish --tag="filament-users-config"
bash
php artisan vendor:publish --tag="filament-cms-config"
bash
php artisan vendor:publish --tag="filament-cms-views"
bash
php artisan vendor:publish --tag="filament-cms-lang"
bash
php artisan vendor:publish --tag="filament-cms-migrations"