Skip to content

Commit 6c688c1

Browse files
authored
Vishal/major (#1029)
1 parent 8e07aea commit 6c688c1

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/Commands/Publish/PublishTablesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function publishDataTableViews()
6666
];
6767

6868
foreach ($files as $stub => $blade) {
69-
$sourceFile = get_template_file_path('scaffold/'.$stub, 'laravel-generator');
69+
$sourceFile = get_file_path('views/scaffold/'.$stub, 'laravel-generator');
7070
$destinationFile = $viewsPath.$blade;
7171
$this->publishFile($sourceFile, $destinationFile, $blade);
7272
}

src/Commands/Publish/PublishUserCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private function copyViews()
4141
$files = $this->getViews();
4242

4343
foreach ($files as $stub => $blade) {
44-
$sourceFile = get_template_file_path('scaffold/'.$stub, $templateType);
44+
$sourceFile = get_file_path('views/templates/'.$stub, $templateType);
4545
$destinationFile = $viewsPath.$blade;
4646
$this->publishFile($sourceFile, $destinationFile, $blade);
4747
}

src/helpers.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ function get_template_file_path(string $templateName, string $templateType): str
6969
}
7070
}
7171

72+
if (!function_exists('get_file_path')) {
73+
function get_file_path(string $templateName, string $templateType): string
74+
{
75+
$templateName = str_replace('.', '/', $templateName);
76+
77+
$templatesPath = config(
78+
'laravel_generator.path.templates_dir',
79+
resource_path('infyom/infyom-generator-templates/')
80+
);
81+
82+
$path = $templatesPath.$templateName.'.blade.php';
83+
84+
if (file_exists($path)) {
85+
return $path;
86+
}
87+
88+
return get_templates_package_path($templateType).'/'.$templateName.'.blade.php';
89+
}
90+
}
91+
7292
if (!function_exists('get_templates_package_path')) {
7393
function get_templates_package_path(string $templateType): string
7494
{

0 commit comments

Comments
 (0)