This commit is contained in:
2025-10-22 20:08:22 +05:00
commit 736e3bef18
2573 changed files with 120385 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Modules\Core\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class ModuleMakeModel extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:model {module} {model}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new model for a module';
/**
* Execute the console command.
*/
public function handle(): void
{
$moduleName = $this->argument('module');
$modelName = $this->argument('model');
$modulePath = modules_path($moduleName);
if (! is_dir($modulePath)) {
$this->error("Module [{$moduleName}] does not exist.");
return;
}
$modelPath = "App\\Modules\\{$moduleName}\\Models\\{$modelName}";
Artisan::call('make:model', [
'name' => $modelPath,
]);
$this->info("Model [{$modelName}] created successfully in module [{$moduleName}].");
}
}