/** * Initialize routes group based on route integration. */ private function initAPIRoutes() { $path = Config::get('generator.path_routes', app_path('Http/routes.php')); $fileHelper = new FileHelper(); $routeContents = $fileHelper->getFileContents($path); $useDingo = Config::get('generator.use_dingo_api', false); if ($useDingo) { $template = 'ding_api_routes_group'; } else { $template = 'api_routes_group'; } $templateHelper = new TemplatesHelper(); $templateData = $templateHelper->getTemplate($template, 'routes'); $templateData = $this->fillTemplate($templateData); $fileHelper->writeFile($path, $routeContents . "\n\n" . $templateData); $this->comment("\nAPI group added to routes.php"); }