mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 03:57:27 +08:00
feat: enhance plugin management
- Add command support for plugin management - Optimize plugin management page layout - Add email copy functionality for users - Convert payment methods and Telegram Bot to plugin system
This commit is contained in:
@@ -99,6 +99,35 @@ abstract class AbstractPlugin
|
||||
HookManager::remove($hook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册 Artisan 命令
|
||||
*/
|
||||
protected function registerCommand(string $commandClass): void
|
||||
{
|
||||
if (class_exists($commandClass)) {
|
||||
app('Illuminate\Contracts\Console\Kernel')->registerCommand(new $commandClass());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册插件命令目录
|
||||
*/
|
||||
public function registerCommands(): void
|
||||
{
|
||||
$commandsPath = $this->basePath . '/Commands';
|
||||
if (File::exists($commandsPath)) {
|
||||
$files = File::glob($commandsPath . '/*.php');
|
||||
foreach ($files as $file) {
|
||||
$className = pathinfo($file, PATHINFO_FILENAME);
|
||||
$commandClass = $this->namespace . '\\Commands\\' . $className;
|
||||
|
||||
if (class_exists($commandClass)) {
|
||||
$this->registerCommand($commandClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断当前请求并返回新的响应
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user