PHP code example of cube-agency / filament-constructor
1. Go to this page and download the library: Download cube-agency/filament-constructor 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/ */
cube-agency / filament-constructor example snippets
namespace App\Filament\Constructor\Blocks;
use CubeAgency\FilamentConstructor\Constructor\Blocks\BlockRenderer;
use Filament\Forms\Components\Textarea;
class DoubleTextBlock extends BlockRenderer
{
public function name(): string
{
return 'double_text';
}
public function title(): string
{
return __('DoubleText');
}
public function schema(): array
{
return [
Textarea::make('first_text'),
Textarea::make('second_text'),
];
}
}
use CubeAgency\FilamentConstructor\Filament\Forms\Components\Constructor;
public static function form(Form $form): Form
{
return $form
->schema([
// ...
Constructor::make('blocks'),
// ...
]);
}
use CubeAgency\FilamentConstructor\Filament\Forms\Components\Constructor;
public static function form(Form $form): Form
{
return $form
->schema([
// ...
Constructor::make('blocks')->use(config('filament-constructor.image_blocks')),
// ...
]);
}
public function title(): string
{
return __('Text block');
}
public function icon(): string
{
return 'heroicon-o-chat-bubble-left-right';
}