Skip to content

Commit 0622be0

Browse files
committed
fix(templates): #882 support for templates from other vendors
1 parent a912df0 commit 0622be0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/Commands/Publish/PublishTemplateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function publishScaffoldTemplates()
5555
{
5656
$templateType = config('infyom.laravel_generator.templates', 'adminlte-templates');
5757

58-
$templatesPath = base_path('vendor/infyomlabs/'.$templateType.'/templates/scaffold');
58+
$templatesPath = get_templates_package_path($templateType).'/templates/scaffold';
5959

6060
return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-templates/scaffold', true);
6161
}

src/helpers.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,24 @@ function get_template_file_path($templateName, $templateType)
100100
return $path;
101101
}
102102

103-
return base_path('vendor/infyomlabs/'.$templateType.'/templates/'.$templateName.'.stub');
103+
return get_templates_package_path($templateType).'/templates/'.$templateName.'.stub';
104+
}
105+
}
106+
107+
if (!function_exists('get_templates_package_path')) {
108+
/**
109+
* Finds templates package's full path
110+
*
111+
* @param string $templateType
112+
* @return string
113+
*/
114+
function get_templates_package_path($templateType)
115+
{
116+
if (strpos($templateType, '/') === false) {
117+
$templateType = base_path('vendor/infyomlabs/').$templateType;
118+
}
119+
120+
return $templateType;
104121
}
105122
}
106123

0 commit comments

Comments
 (0)