定制 uni-deal/filament-relationship-builder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

uni-deal/filament-relationship-builder

最新稳定版本:v1.0

Composer 安装命令:

composer require uni-deal/filament-relationship-builder

包简介

Registers a FilamentPHP builder via an Eloquent relationship with order, type, and data columns.

README 文档

README

Latest Version on Packagist Total Downloads

A simple package to register a FilamentPHP builder via an Eloquent relationship with columns: order, type, and data.

Installation

To install this package, you can use Composer directly from the GitHub repository.

Run the following command in your terminal:

composer require uni-deal/filament-relationship-builder

Once installed, you can start using the RelationshipBuilder component as shown in the example above.

Example Usage

use UniDeal\FilamentRelationshipBuilder\Components\RelationshipBuilder;

RelationshipBuilder::make('blocks')
    ->relationship()
    ->blocks([
        Forms\Components\Builder\Block::make('Heading')->schema([
            Forms\Components\TextInput::make('content')
        ])
    ]),

Model Requirements

The targeted model must contain a cast on the data column of type array:

class Block extends \Illuminate\Database\Eloquent\Model {
    // Before Laravel 11
    protected $casts = [
        'data' => 'array',
    ];

    // For Laravel 11+
    protected function casts(): array {
        return [
            'data' => 'array',    
        ];
    }
}

Register the blocks relation on the initial model:

class Post extends \Illuminate\Database\Eloquent\Model {
    public function blocks() {
        return $this->hasMany(Block::class);
    }
}

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-16