Skip to content

Commit 6cba831

Browse files
committed
fix: various fixes
1 parent ec7d6cc commit 6cba831

24 files changed

+51
-51
lines changed

config/laravel_generator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
'schema_files' => resource_path('model_schemas/'),
3939

40-
'templates_dir' => resource_path('infyom/infyom-generator-stubs/'),
40+
'templates_dir' => resource_path('infyom/infyom-generator-templates/'),
4141

4242
'seeder' => database_path('seeders/'),
4343

@@ -103,7 +103,7 @@
103103
|
104104
*/
105105

106-
'stubs' => 'adminlte-stubs',
106+
'templates' => 'adminlte-templates',
107107

108108
/*
109109
|--------------------------------------------------------------------------

src/Commands/BaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function performPostActions($runMigration = false)
157157
$requestFromConsole = (php_sapi_name() == 'cli');
158158
if ($this->option('jsonFromGUI') && $requestFromConsole) {
159159
$this->runMigration();
160-
} elseif ($requestFromConsole && $this->confirm(PHP_EOL.'Do you want to migrate database? [y|N]', false)) {
160+
} elseif ($requestFromConsole && $this->confirm(infy_nl().'Do you want to migrate database? [y|N]', false)) {
161161
$this->runMigration();
162162
}
163163
}
@@ -253,7 +253,7 @@ private function saveLocaleFile()
253253
if (file_exists($path.$fileName) && !$this->confirmOverwrite($fileName)) {
254254
return;
255255
}
256-
$content = "<?php\n\nreturn ".var_export($locales, true).';'.PHP_EOL;
256+
$content = "<?php\n\nreturn ".var_export($locales, true).';'.infy_nl();
257257
g_filesystem()->createFile($path.$fileName, $content);
258258
$this->comment("\nModel Locale File saved: ");
259259
$this->info($fileName);

src/Commands/Publish/GeneratorPublishCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ private function updateRouteServiceProvider()
4646

4747
$fileContent = g_filesystem()->getFile($routeServiceProviderPath);
4848

49-
$search = "Route::middleware('api')".PHP_EOL.str(' ')->repeat(16)."->prefix('api')";
49+
$search = "Route::middleware('api')".infy_nl().str(' ')->repeat(16)."->prefix('api')";
5050
$beforeContent = str($fileContent)->before($search);
5151
$afterContent = str($fileContent)->after($search);
5252

53-
$finalContent = $beforeContent.$search.PHP_EOL.str(' ')->repeat(16)."->as('api.')".$afterContent;
53+
$finalContent = $beforeContent.$search.infy_nl().str(' ')->repeat(16)."->as('api.')".$afterContent;
5454
g_filesystem()->createFile($routeServiceProviderPath, $finalContent);
5555
}
5656

src/Commands/Publish/PublishTablesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function handle()
4343
public function publishLivewireTableViews()
4444
{
4545
$viewsPath = config('laravel_generator.path.views', resource_path('views/'));
46-
$templateType = config('infyom.laravel_generator.stubs', 'adminlte-stubs');
46+
$templateType = config('infyom.laravel_generator.templates', 'adminlte-templates');
4747

4848
$files = [
4949
'views/table/livewire/actions' => 'common/livewire-tables/actions.blade.php',

src/Commands/Publish/PublishTemplatesCommand.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ class PublishTemplatesCommand extends PublishBaseCommand
99
*
1010
* @var string
1111
*/
12-
protected $name = 'infyom.publish:stubs';
12+
protected $name = 'infyom.publish:templates';
1313

1414
/**
1515
* The console command description.
1616
*
1717
* @var string
1818
*/
19-
protected $description = 'Publishes api generator stubs.';
19+
protected $description = 'Publishes api generator templates.';
2020

2121
private string $templatesDir;
2222

2323
public function handle()
2424
{
2525
$this->templatesDir = config(
2626
'laravel_generator.path.templates_dir',
27-
resource_path('infyom/infyom-generator-stubs/')
27+
resource_path('infyom/infyom-generator-templates/')
2828
);
2929

3030
if ($this->publishGeneratorTemplates()) {
@@ -35,23 +35,23 @@ public function handle()
3535

3636
public function publishGeneratorTemplates(): bool
3737
{
38-
$templatesPath = __DIR__ . '/../../../stubs';
38+
$templatesPath = __DIR__ . '/../../../views';
3939

40-
return $this->publishDirectory($templatesPath, $this->templatesDir, 'infyom-generator-stubs');
40+
return $this->publishDirectory($templatesPath, $this->templatesDir, 'infyom-generator-templates');
4141
}
4242

4343
public function publishScaffoldTemplates(): bool
4444
{
45-
$templateType = config('laravel_generator.stubs', 'adminlte-stubs');
45+
$templateType = config('laravel_generator.templates', 'adminlte-templates');
4646

47-
$templatesPath = get_templates_package_path($templateType).'/stubs/scaffold';
47+
$templatesPath = get_templates_package_path($templateType).'/templates/scaffold';
4848

49-
return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-stubs/scaffold', true);
49+
return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-templates/scaffold', true);
5050
}
5151

5252
public function publishSwaggerTemplates(): bool
5353
{
54-
$templatesPath = base_path('vendor/infyomlabs/swagger-generator/stubs');
54+
$templatesPath = base_path('vendor/infyomlabs/swagger-generator/templates');
5555

5656
return $this->publishDirectory($templatesPath, $this->templatesDir, 'swagger-generator', true);
5757
}

src/Commands/Publish/PublishUserCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function handle()
3434
private function copyViews()
3535
{
3636
$viewsPath = config('laravel_generator.path.views', resource_path('views/'));
37-
$templateType = config('laravel_generator.stubs', 'adminlte-stubs');
37+
$templateType = config('laravel_generator.templates', 'adminlte-templates');
3838

3939
$this->createDirectories($viewsPath.'users');
4040

@@ -83,7 +83,7 @@ private function updateRoutes()
8383
private function updateMenu()
8484
{
8585
$viewsPath = config('laravel_generator.path.views', resource_path('views/'));
86-
$templateType = config('laravel_generator.stubs', 'adminlte-stubs');
86+
$templateType = config('laravel_generator.templates', 'adminlte-templates');
8787
$path = $viewsPath.'layouts/menu.blade.php';
8888
$menuContents = g_filesystem()->getFile($path);
8989
$sourceFile = g_filesystem()->getFile(get_template_file_path('scaffold/users/menu', $templateType));

src/Generators/API/APIControllerGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function generate()
4545

4646
g_filesystem()->createFile($this->path.$this->fileName, $templateData);
4747

48-
$this->config->commandComment(PHP_EOL.'API Controller created: ');
48+
$this->config->commandComment(infy_nl().'API Controller created: ');
4949
$this->config->commandInfo($this->fileName);
5050
}
5151

src/Generators/API/APIRequestGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private function generateCreateRequest()
3232

3333
g_filesystem()->createFile($this->path.$this->createFileName, $templateData);
3434

35-
$this->config->commandComment(PHP_EOL.'Create Request created: ');
35+
$this->config->commandComment(infy_nl().'Create Request created: ');
3636
$this->config->commandInfo($this->createFileName);
3737
}
3838

@@ -47,7 +47,7 @@ private function generateUpdateRequest()
4747

4848
g_filesystem()->createFile($this->path.$this->updateFileName, $templateData);
4949

50-
$this->config->commandComment(PHP_EOL.'Update Request created: ');
50+
$this->config->commandComment(infy_nl().'Update Request created: ');
5151
$this->config->commandInfo($this->updateFileName);
5252
}
5353

src/Generators/API/APIResourceGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function generate()
2929

3030
g_filesystem()->createFile($this->path.$this->fileName, $templateData);
3131

32-
$this->config->commandComment(PHP_EOL.'API Resource created: ');
32+
$this->config->commandComment(infy_nl().'API Resource created: ');
3333
$this->config->commandInfo($this->fileName);
3434
}
3535

src/Generators/API/APIRoutesGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public function generate()
2121
$routes = view('laravel-generator::api.routes', $this->variables())->render();
2222

2323
if (Str::contains($routeContents, $routes)) {
24-
$this->config->commandInfo(PHP_EOL.'Menu '.$this->config->modelNames->dashedPlural.' already exists, Skipping Adjustment.');
24+
$this->config->commandInfo(infy_nl().'Menu '.$this->config->modelNames->dashedPlural.' already exists, Skipping Adjustment.');
2525

2626
return;
2727
}
2828

29-
$routeContents .= PHP_EOL.PHP_EOL.$routes;
29+
$routeContents .= infy_nls(2).$routes;
3030

3131
g_filesystem()->createFile($this->path, $routeContents);
3232

33-
$this->config->commandComment(PHP_EOL.$this->config->modelNames->dashedPlural.' api routes added.');
33+
$this->config->commandComment(infy_nl().$this->config->modelNames->dashedPlural.' api routes added.');
3434
}
3535

3636
public function rollback()

0 commit comments

Comments
 (0)