PHP code example of uni-deal / filament-relationship-builder
1. Go to this page and download the library: Download uni-deal/filament-relationship-builder 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/ */
uni-deal / filament-relationship-builder example snippets
use UniDeal\FilamentRelationshipBuilder\Components\RelationshipBuilder;
RelationshipBuilder::make('blocks')
->relationship()
->blocks([
Forms\Components\Builder\Block::make('Heading')->schema([
Forms\Components\TextInput::make('content')
])
]),
class Block extends \Illuminate\Database\Eloquent\Model {
// Before Laravel 11
protected $casts = [
'data' => 'array',
];
// For Laravel 11+
protected function casts(): array {
return [
'data' => 'array',
];
}
}
class Post extends \Illuminate\Database\Eloquent\Model {
public function blocks() {
return $this->hasMany(Block::class);
}
}