public function slash()
 {
     $arg_name = ucfirst($this->input->getArgument('name'));
     $stub = file_get_contents(__DIR__ . '/stubs/makeRoute.stub');
     $stub = str_replace('{routeName}', $arg_name, $stub);
     $stub = str_replace('{prefixRouteName}', strtolower($arg_name), $stub);
     $file_name = $arg_name . 'Routes.php';
     $module = $this->input->getArgument('module');
     $hasDir = is_dir(config()->path->app . $module);
     if ($hasDir == false) {
         $this->error('Module not found `' . $module . '`');
         return;
     }
     $routesDir = config()->path->app . $module . '/Routes';
     if (is_dir($routesDir) == false) {
         $this->error('Routes folder not found from your module: `' . $module . '`');
         return;
     }
     chdir($routesDir);
     $stub = str_replace('{namespace}', 'App\\' . $module . '\\Routes', $stub);
     $stub = str_replace('{controllerNamespace}', 'App\\' . $module . '\\Controllers', $stub);
     $this->info('Crafting Route Group...');
     if (file_exists($file_name)) {
         $this->error('   Route already exists!');
         return;
     }
     file_put_contents($file_name, $stub);
     $this->comment('   Route has been created!');
     chdir(config()->path->root);
     CLI::bash(['composer dumpautoload']);
 }
 public function slash()
 {
     $this->info('Removing compiled file...');
     @unlink(BASE_PATH . '/storage/slayer/compiled.php');
     $output = CLI::bash(['php vendor/classpreloader/console/classpreloader.php compile ' . '--config="bootstrap/compiler.php" ' . '--output="storage/slayer/compiled.php" ' . '--strip_comments=1']);
     $this->comment($output);
 }
Exemple #3
0
 public function slash()
 {
     $script = $this->input->getArgument('script');
     $lists = config()->script->toArray();
     if (isset($lists[$script]) == false) {
         $this->error("\nWe can't find `" . $script . '` in the lists of script.' . "\n");
         return;
     }
     $lines = $lists[$script];
     $output = CLI::bash($lines);
     if ($output) {
         $this->comment($output);
     }
 }
 public function slash()
 {
     $arg_name = ucfirst($this->input->getArgument('name'));
     # - get the main stub file
     $stub = file_get_contents(__DIR__ . '/stubs/makeController.stub');
     $stub = str_replace('{controllerName}', $arg_name, $stub);
     # - to use emptify
     if ($this->input->getOption('emptify') == true) {
         $stub = str_replace('{controllerFunctions}', '', $stub);
     } else {
         $_controllerFunctions = file_get_contents(__DIR__ . '/stubs/_controllerFunctions.stub');
         $stub = str_replace('{controllerFunctions}', $_controllerFunctions, $stub);
         $stub = str_replace('{controllerName}', strtolower($arg_name), $stub);
     }
     # create the file name
     $file_name = $arg_name . 'Controller.php';
     $module = $this->input->getArgument('module');
     $hasDir = is_dir(config()->path->app . $module);
     if ($hasDir == false) {
         $this->error('Module not found `' . $module . '`');
         return;
     }
     $controllersDir = config()->path->app . $module . '/Controllers';
     if (is_dir($controllersDir) == false) {
         $this->error('Controllers folder not found from your module: `' . $module . '`');
         return;
     }
     chdir($controllersDir);
     $stub = str_replace('{namespace}', 'App\\' . $module . '\\Controllers', $stub);
     $this->comment('Crafting Controller...');
     if (file_exists($file_name)) {
         $this->error('   Controller already exists!');
         return;
     }
     file_put_contents($file_name, $stub);
     $this->info('   Controller has been created!');
     chdir(config()->path->root);
     CLI::bash(['composer dumpautoload']);
 }