PHP code example of catchadmin / plugin
1. Go to this page and download the library: Download catchadmin/plugin library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
catchadmin / plugin example snippets
// src/Hook.php
class Hook
{
public static function afterInstall(array $pluginInfo): void
{
// 安装后执行
Artisan::call('migrate', [
'--path' => 'vendor/my/plugin/database/migrations',
]);
}
public static function beforeUninstall(array $pluginInfo): void
{
// 卸载前执行
}
}
bash
php artisan catch:plugin-init
bash
# 安装插件
php artisan catch:plugin-install
# 打包插件
php artisan catch:plugin-pack