# Filament tool for improve management of pages content speed and easy
This package comes with predefined form components that can be used to build a page:
- Text
- ImageUpload
- TextBox
- Marquee
- Slider
You can install the package via composer:
composer require softok2/filament-page-builder
You can set up all the necessary files by running the following command:
php artisan filament-page-builder:install
php artisan migrate --seed
The packages come with a predefined page blocks and layout components in App//Filament//PageBuilder
.
Page blocks look like this:
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);
}
}
Define your own section per page declaring a method with the name and de Section
suffix.
Include the plugins in your admin panel:
...
->plugins([
FilamentPageBuilder::make()
])
Yoy can define your own blocks and components by creating both classes and mapping them in the plugin configuration.
For create a new block you can run the following command:
php artisan filament-page-builder-block:make HistoryBlock
For create a new layout component you can run the following command:
php artisan filament-page-builder-lc:make HeroComponent
Then you can map the new blocks and components in the plugin configuration:
FilamentPageBuilder::make()
->withPosts()
->blocksMapper([
'history' => HistoryBlock::class,
])
->layoutsComponentsMapper([
'hero' => HeroComponent::class,
])
In the example above, 'history' and 'hero' are the name of the page and component respectively. You can easly add them in the seeders:
- PageSeeder.php
- LayoutComponentSeeder.php
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.