|
| 1 | +# Builder Block |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | +<a href="https://packagist.org/packages/rmitesh/builder-block"><img alt="Latest Stable Version" src="https://img.shields.io/packagist/v/rmitesh/builder-block.svg?style=for-the-badge"></a> |
| 7 | +<a href="https://packagist.org/packages/rmitesh/builder-block"><img alt="Total Downloads" src="https://img.shields.io/packagist/dt/rmitesh/builder-block.svg?style=for-the-badge"></a> |
| 8 | +<a href="https://laravel.com"><img alt="Laravel v10.x" src="https://img.shields.io/badge/Laravel-v10.x-FF2D20?style=for-the-badge&logo=laravel"></a> |
| 9 | +<a href="https://php.net"><img alt="PHP 8.1" src="https://img.shields.io/badge/PHP-8.1-777BB4?style=for-the-badge&logo=php"></a> |
| 10 | +</p> |
| 11 | + |
| 12 | +Builder Block is collection of prebuilt Builder block of Filament for the CMS pages. |
| 13 | +Everything will store in JSON format, using this data you can display content dynamically. |
| 14 | + |
| 15 | +If you are using ![filament-fabricator][https://github.com/Z3d0X/filament-fabricator] then this is perfact package for your dynamic pages. |
| 16 | + |
| 17 | +It comes with following blocks: |
| 18 | + |
| 19 | +1. Hero section (Left and right side) |
| 20 | + |
| 21 | + |
| 22 | +2. Cards |
| 23 | + |
| 24 | + |
| 25 | +3. Mini states |
| 26 | + |
| 27 | + |
| 28 | +4. Information boxes |
| 29 | + |
| 30 | + |
| 31 | +5. FAQs |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +## Installation |
| 36 | + |
| 37 | +You can install the package via composer: |
| 38 | + |
| 39 | +```bash |
| 40 | +composer require rmitesh/builder-block |
| 41 | +``` |
| 42 | + |
| 43 | +## How to use |
| 44 | + |
| 45 | +```php |
| 46 | +use Filament\Forms; |
| 47 | +use Filament\Forms\Form; |
| 48 | +use Rmitesh\BuilderBlock\Facades\BuilderBlock; |
| 49 | + |
| 50 | +public static function form(Form $form): Form |
| 51 | +{ |
| 52 | + return $form |
| 53 | + ->schema([ |
| 54 | + // your components ... |
| 55 | + |
| 56 | + Forms\Components\Builder::make('content') |
| 57 | + ->blocks( |
| 58 | + BuilderBlock::make() |
| 59 | + ->get(), |
| 60 | + ), |
| 61 | + |
| 62 | + // your components ... |
| 63 | + ]); |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +and if you want to add your custom blocks then you can add using `addBlock` function. |
| 68 | + |
| 69 | +```php |
| 70 | +BuilderBlock::make() |
| 71 | + ->addBlock( |
| 72 | + Forms\Components\Builder\Block::make('my_custom_block') |
| 73 | + ->columns(4) |
| 74 | + ->icon('heroicon-m-information-circle') |
| 75 | + ->schema([ |
| 76 | + // add your form components |
| 77 | + ]), |
| 78 | + ) |
| 79 | + ->get() |
| 80 | +``` |
| 81 | + |
| 82 | +Also, you can add multiple blocks using `addBlocks` function. |
| 83 | + |
| 84 | +```php |
| 85 | +BuilderBlock::make() |
| 86 | + ->addBlocks([ |
| 87 | + Forms\Components\Builder\Block::make('my_custom_block_1') |
| 88 | + ->columns(4) |
| 89 | + ->icon('heroicon-m-information-circle') |
| 90 | + ->schema([ |
| 91 | + // add your form components |
| 92 | + ]), |
| 93 | + |
| 94 | + Forms\Components\Builder\Block::make('my_custom_block_2') |
| 95 | + ->columns(4) |
| 96 | + ->icon('heroicon-m-information-circle') |
| 97 | + ->schema([ |
| 98 | + // add your form components |
| 99 | + ]), |
| 100 | + ]) |
| 101 | + ->get() |
| 102 | +``` |
| 103 | + |
| 104 | +## Changelog |
| 105 | + |
| 106 | +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
| 107 | + |
| 108 | +## Contributing |
| 109 | + |
| 110 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 111 | + |
| 112 | +## Security Vulnerabilities |
| 113 | + |
| 114 | +Please review [our security policy](../../security/policy) on how to report security vulnerabilities. |
| 115 | + |
| 116 | +## Credits |
| 117 | + |
| 118 | +- [Mitesh Rathod](https://github.com/rmitesh) |
| 119 | +- [All Contributors](../../contributors) |
| 120 | + |
| 121 | +## License |
| 122 | + |
| 123 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments