feat: add article and production modules
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\article;
|
||||
|
||||
use core\plugin\PluginInstall as BasePluginInstall;
|
||||
|
||||
/**
|
||||
* 插件安装类
|
||||
* 继承 PluginInstall 基类,自动处理:
|
||||
* - 数据库迁移 (resource/database/migrations/)
|
||||
* - 种子数据 (resource/database/seeds/)
|
||||
*
|
||||
* 菜单需要按需导入或卸载;模板在安装时导入,物理删除由删除插件阶段统一处理:
|
||||
* - $this->importPluginMenus() - 导入菜单
|
||||
* - $this->importTemplates() - 复制模板
|
||||
* - $this->uninstallPluginMenus() - 卸载菜单
|
||||
*/
|
||||
class Install extends BasePluginInstall
|
||||
{
|
||||
/**
|
||||
* 安装前回调
|
||||
*/
|
||||
protected function beforeInstall(string $version): void
|
||||
{
|
||||
$this->output(" 🔄 Running beforeInstall...\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装后回调 - 按需导入菜单和模板
|
||||
*/
|
||||
protected function afterInstall(string $version): void
|
||||
{
|
||||
$this->output(" 🔄 Running afterInstall...\n");
|
||||
|
||||
// 导入菜单
|
||||
$this->importPluginMenus();
|
||||
|
||||
// 复制模板资源
|
||||
$this->importTemplates();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载前回调
|
||||
*/
|
||||
protected function beforeUninstall(string $version): void
|
||||
{
|
||||
$this->output(" 🔄 Running beforeUninstall...\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载后回调 - 清理菜单
|
||||
*/
|
||||
protected function afterUninstall(string $version): void
|
||||
{
|
||||
$this->output(" 🔄 Running afterUninstall...\n");
|
||||
// 卸载菜单
|
||||
$this->uninstallPluginMenus();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user