Skip to content

Commit dffd26f

Browse files
committed
[feat] add method prohibitDestructiveCommands to facade module
1 parent 5607d45 commit dffd26f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Facades/Module.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace Nwidart\Modules\Facades;
44

55
use Illuminate\Support\Facades\Facade;
6+
use Nwidart\Modules\Commands\Database\MigrateFreshCommand;
7+
use Nwidart\Modules\Commands\Database\MigrateRefreshCommand;
8+
use Nwidart\Modules\Commands\Database\MigrateResetCommand;
69

710
/**
811
* @method static array all()
@@ -19,7 +22,7 @@
1922
* @method static \Nwidart\Modules\Module findOrFail(string $name)
2023
* @method static string getModulePath($moduleName)
2124
* @method static \Illuminate\Filesystem\Filesystem getFiles()
22-
* @method static mixed config(string $key, $default = NULL)
25+
* @method static mixed config(string $key, $default = null)
2326
* @method static string getPath()
2427
* @method static void boot()
2528
* @method static void register(): void
@@ -30,6 +33,21 @@
3033
*/
3134
class Module extends Facade
3235
{
36+
/**
37+
* Indicate if destructive Artisan commands should be prohibited.
38+
*
39+
* Prohibits: module:migrate-fresh, module:migrate-refresh, and module:migrate-reset
40+
*
41+
* @param bool $prohibit
42+
* @return void
43+
*/
44+
public static function prohibitDestructiveCommands(bool $prohibit = true): void
45+
{
46+
MigrateFreshCommand::prohibit($prohibit);
47+
MigrateRefreshCommand::prohibit($prohibit);
48+
MigrateResetCommand::prohibit($prohibit);
49+
}
50+
3351
protected static function getFacadeAccessor(): string
3452
{
3553
return 'modules';

0 commit comments

Comments
 (0)