/**
  * Prepare variables for stubs.
  *
  * return @array
  */
 protected function prepareVars()
 {
     $pluginCode = $this->argument('plugin');
     $parts = explode('.', $pluginCode);
     $plugin = array_pop($parts);
     $author = array_pop($parts);
     $controller = $this->argument('controller');
     /*
      * Determine the model name to use,
      * either supplied or singular from the controller name.
      */
     $model = $this->option('model');
     if (!$model) {
         $model = Str::singular($controller);
     }
     return ['name' => $controller, 'model' => $model, 'author' => $author, 'plugin' => $plugin];
 }
 /**
  * Execute the console command.
  */
 public function fire()
 {
     /*
      * Extract the author and name from the plugin code
      */
     $pluginCode = $this->argument('pluginCode');
     $parts = explode('.', $pluginCode);
     $pluginName = array_pop($parts);
     $authorName = array_pop($parts);
     $destinationPath = base_path() . '/plugins/' . strtolower($authorName) . '/' . strtolower($pluginName);
     $controllerName = $this->argument('controllerName');
     /*
      * Determine the model name to use,
      * either supplied or singular from the controller name.
      */
     $modelName = $this->option('model');
     if (!$modelName) {
         $modelName = Str::singular($controllerName);
     }
     $vars = ['name' => $controllerName, 'model' => $modelName, 'author' => $authorName, 'plugin' => $pluginName];
     Controller::make($destinationPath, $vars, $this->option('force'));
     $this->info(sprintf('Successfully generated Controller and views for "%s"', $controllerName));
 }
Beispiel #3
0
 /**
  * Get the singular form of an English word.
  *
  * @param string $value
  * @return string 
  * @static 
  */
 public static function singular($value)
 {
     //Method inherited from \Illuminate\Support\Str
     return \October\Rain\Support\Str::singular($value);
 }