Skip to content

Commit

Permalink
Исправил создание ссылки при установке модуля при выключенной функции…
Browse files Browse the repository at this point in the history
… symlink и исправил миграции модулей
  • Loading branch information
visavi committed Sep 7, 2021
1 parent 17cbab0 commit dad04e7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/Models/Module.php
Expand Up @@ -51,7 +51,11 @@ public function migrate(string $modulePath): void
$migrationPath = $modulePath . '/migrations';

if (file_exists($migrationPath)) {
Artisan::call('migrate --realpath --path=' . $migrationPath);
Artisan::call('migrate', [
'--force' => true,
'--realpath' => true,
'--path' => $migrationPath,
]);
}
}

Expand All @@ -73,7 +77,11 @@ public function rollback(string $modulePath): void
->whereIn('migration', $migrationNames)
->update(['batch' => $nextBatchNumber]);

Artisan::call('migrate:rollback --realpath --path=' . $migrationPath);
Artisan::call('migrate:rollback', [
'--force' => true,
'--realpath' => true,
'--path' => $migrationPath,
]);
}
}

Expand All @@ -93,7 +101,11 @@ public function createSymlink(string $modulePath): void
return;
}

$filesystem->symlink($modulesPath, $originPath, true);
if (function_exists('symlink')) {
$filesystem->symlink($modulesPath, $originPath, true);
} else {
$filesystem->mirror($modulesPath, $originPath, null, ['override' => true, 'delete' => true]);
}
}

/**
Expand Down

0 comments on commit dad04e7

Please sign in to comment.