public static function getTemplateFilePath($templateName, $templateType)
{
$templateName = str_replace('.', '/', $templateName);
$templatesPath = config('infyom.laravel_generator.path.templates_dir', base_path('resources/infyom/infyom-generator-templates/'));
$path = $templatesPath . $templateName . '.stub';
if (file_exists($path)) {
return $path;
}
return base_path('vendor/infyomlabs/' . $templateType . '/templates/' . $templateName . '.stub');
}
private function copyView() { $viewsPath = config('infyom.laravel_generator.path.views', base_path('resources/views/')); $templateType = config('infyom.laravel_generator.templates', 'core-templates'); $this->createDirectories($viewsPath); $files = $this->getViews(); foreach ($files as $stub => $blade) { $sourceFile = TemplateUtil::getTemplateFilePath('scaffold/' . $stub, $templateType); $destinationFile = $viewsPath . $blade; $this->publishFile($sourceFile, $destinationFile, $blade); } }