/**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $namespace = $this->argument('namespace');
     $templateHelper = new TemplatesHelper();
     $templateData = $templateHelper->getTemplate('AppBaseController', 'Controller');
     $templateData = str_replace('$$BASE_NAMESPACE$$', $namespace, $templateData);
     $fileName = "AppBaseController.php";
     $filePath = __DIR__ . "/../../Controller/";
     $fileHelper = new FileHelper();
     $fileHelper->writeFile($filePath . $fileName, $templateData);
     $this->comment('AppBaseController generated');
     $this->info($fileName);
 }
 /**
  * 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 = 'dingo_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");
 }
Ejemplo n.º 3
0
 private function initAdminRoutes()
 {
     $path = Config::get('generator.path_routes', app_path('Http/routes.php'));
     $fileHelper = new FileHelper();
     $routeContents = $fileHelper->getFileContents($path);
     $template = 'admin_routes_group';
     $templateHelper = new TemplatesHelper();
     $templateData = $templateHelper->getTemplate($template, 'routes');
     $templateData = $this->fillTemplate($templateData);
     $fileHelper->writeFile($path, $routeContents . "\n\n" . $templateData);
     $this->comment("\n ADMIN group added to routes.php");
 }