mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
29 lines
712 B
PHP
29 lines
712 B
PHP
<?php
|
|
namespace Nexus\Plugin;
|
|
|
|
use App\Repositories\BaseRepository;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
abstract class BasePlugin extends BaseRepository
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|