mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-10 03:42:49 +08:00
新增LoadMigrationFiles事件,支持扩展提供的数据库迁移文件
This commit is contained in:
@@ -18,6 +18,9 @@ return [
|
|||||||
'AdminLoginType' => [
|
'AdminLoginType' => [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
'LoadMigrationFiles'=>[
|
||||||
|
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'subscribe' => [
|
'subscribe' => [
|
||||||
|
|||||||
@@ -233,6 +233,15 @@ function build_upload_url($url, $upload_type = null)
|
|||||||
return Filesystem::disk($upload_type)->url($url);
|
return Filesystem::disk($upload_type)->url($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行扩展事件
|
||||||
|
*
|
||||||
|
* @param string $name 事件名称
|
||||||
|
* @param string $key 处理的key
|
||||||
|
* @param string $type 处理模式
|
||||||
|
* @param array $params 传参
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function event_handle_result($name, $key, $type = 'all', $params = []) : array
|
function event_handle_result($name, $key, $type = 'all', $params = []) : array
|
||||||
{
|
{
|
||||||
$list_result = Event::trigger($name, $params);
|
$list_result = Event::trigger($name, $params);
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ abstract class Migrate extends Command
|
|||||||
if (null === $this->migrations) {
|
if (null === $this->migrations) {
|
||||||
$phpFiles = glob($this->getPath() . DIRECTORY_SEPARATOR . '*.php', defined('GLOB_BRACE') ? GLOB_BRACE : 0);
|
$phpFiles = glob($this->getPath() . DIRECTORY_SEPARATOR . '*.php', defined('GLOB_BRACE') ? GLOB_BRACE : 0);
|
||||||
|
|
||||||
|
$event_files = event_handle_result('LoadMigrationFiles','file_list');
|
||||||
|
|
||||||
|
foreach ($event_files as $file_list) {
|
||||||
|
foreach ($file_list as $file_path) {
|
||||||
|
$phpFiles[] = $file_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// filter the files to only get the ones that match our naming scheme
|
// filter the files to only get the ones that match our naming scheme
|
||||||
$fileNames = [];
|
$fileNames = [];
|
||||||
/** @var Migrator[] $versions */
|
/** @var Migrator[] $versions */
|
||||||
|
|||||||
Reference in New Issue
Block a user