feat: 插件依赖强制校验 + 文章后台表单/表格注入 hook

- PluginManager: requires 依赖链校验(enable 需依赖已启用,disable 阻止有启用依赖者的插件,boot 跳过依赖未满足插件),all() 输出依赖状态供后台展示
- Plugins 页:卡片显示依赖链徽章,依赖未满足时禁用启用按钮,启停失败弹错误通知
- PostResource: form()/table() 增加 filament.post_form / filament.post_table 注入点
- membership 插件:注入「付费设置」Section(meta.price 单篇价格 + meta.members_only 会员专享)与表格价格/会员列
This commit is contained in:
ak
2026-08-12 00:18:40 +08:00
parent 19fd48213d
commit 4f59afb7ce
8 changed files with 329 additions and 7 deletions
@@ -17,11 +17,24 @@
<p class="mt-1 flex-1 text-sm text-gray-500 dark:text-gray-400">{{ $plugin['description'] }}</p>
<p class="mt-2 text-xs text-gray-400">v{{ $plugin['version'] }} · {{ $plugin['vendor'] }}.{{ $plugin['name'] }}</p>
@if(! empty($plugin['dependencies']))
<div class="mt-2 flex flex-wrap items-center gap-1">
<span class="text-xs text-gray-400">依赖:</span>
@foreach($plugin['dependencies'] as $dep)
<x-filament::badge :color="$dep['ok'] ? 'success' : 'danger'" size="xs">
{{ $dep['title'] }}@if(! $dep['ok']){{ $dep['reason'] }}@endif
</x-filament::badge>
@endforeach
</div>
@endif
<div class="mt-4 flex flex-wrap gap-2">
@if($plugin['enabled'])
<x-filament::button size="sm" color="gray" wire:click="disablePlugin('{{ $plugin['key'] }}')">停用</x-filament::button>
@else
@elseif(empty($plugin['dependency_errors']))
<x-filament::button size="sm" color="success" wire:click="enablePlugin('{{ $plugin['key'] }}')">启用</x-filament::button>
@else
<x-filament::badge color="warning">依赖未满足,无法启用</x-filament::badge>
@endif
@if(! in_array($plugin['key'], config('plugins.enabled', []), true))
<x-filament::button size="sm" color="danger" wire:click="uninstallPlugin('{{ $plugin['key'] }}')" wire:confirm="确定卸载该插件?">卸载</x-filament::button>