定制 eightynine/filament-master-detail 二次开发

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

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

eightynine/filament-master-detail

Composer 安装命令:

composer require eightynine/filament-master-detail

包简介

This is my package filament-master-detail

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds a master–detail layout for Filament resources. It renders a table on the left and the selected record’s page on the right, with pagination and deep links preserved.

Installation

You can install the package via Composer:

composer require eightynine/filament-master-detail

Publish and run the migrations:

php artisan vendor:publish --tag="filament-master-detail-migrations"
php artisan migrate

Publish the config file:

php artisan vendor:publish --tag="filament-master-detail-config"

Optionally, publish the views:

php artisan vendor:publish --tag="filament-master-detail-views"

Configuration

After publishing, you can customize settings in config/master-detail.php.

This is the contents of the published config file (currently no options; reserved for future use):

return [
];

Usage

  1. Register the plugin in your Filament Panel provider and set the scopes (resources to use in the master–detail view):
use App\Providers\Filament\AdminPanelProvider; // or your custom Panel provider
use Filament\Panel;
use EightyNine\MasterDetail\MasterDetailPlugin;
use App\Filament\Resources\CustomerResource; // example
use App\Filament\Resources\OrderResource;    // example

class AdminPanelProvider extends AdminPanelProvider
{
	public function panel(Panel $panel): Panel
	{
		return $panel
			// ... other panel config
			->plugin(MasterDetailPlugin::make()
            ->scopes([
                OrderResource::class
            ]));
	}
}
  1. In your target Filament Resource, implement getMasterDetailColumns() to define the table columns used in the master–detail view:
use Filament\Tables; 
use Filament\Tables\Columns\TextColumn;

public function getMasterDetailColumns(): array
{
	return [
		TextColumn::make('id')->label('ID')->sortable(),
		TextColumn::make('name')->searchable()->toggleable(),
		// add more columns as needed
	];
}

Optional (advanced):

  • Customize the base query used by the master–detail table by adding a static method to your Resource:
public static function modifyMasterDetailQuery(\Illuminate\Database\Eloquent\Builder $query)
{
	return $query->latest();
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-10