Files
nexusphp/nexus/Plugin/BasePlugin.php

29 lines
712 B
PHP
Raw Normal View History

2022-06-03 03:42:53 +08:00
<?php
namespace Nexus\Plugin;
2022-06-08 14:15:59 +08:00
use App\Repositories\BaseRepository;
2022-06-03 03:42:53 +08:00
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Artisan;
2022-06-08 14:15:59 +08:00
abstract class BasePlugin extends BaseRepository
2022-06-03 03:42:53 +08:00
{
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);
}
}
}