support plugin

This commit is contained in:
xiaomlove
2022-06-03 03:42:53 +08:00
parent 29d414ce0a
commit 44c750234a
21 changed files with 333 additions and 68 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Nexus\Plugin;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Artisan;
abstract class BasePlugin
{
abstract function install();
abstract function boot();
public function runMigrations($dir, $rollback = false)
{
$command = "migrate";
if ($rollback) {
$command .= ":rollback";
}
$command .= " --realpath --force";
foreach (glob("$dir/*.php") as $file) {
$file = str_replace('\\', '/', $file);
$toExecute = "$command --path=$file";
do_log("command: $toExecute");
Artisan::call($toExecute);
}
}
}