Пример #1
0
 /**
  * Get the console command options.
  *
  * @return array
  */
 protected function getOptions()
 {
     return $this->mergeOptions(array(array('path', null, InputOption::VALUE_OPTIONAL, 'Path to views directory.', ''), array('template', null, InputOption::VALUE_OPTIONAL, 'Path to template.', GeneratorsServiceProvider::getTemplatePath('view.txt'))));
 }
 /**
  * Get the console command options.
  *
  * @return array
  */
 protected function getOptions()
 {
     return $this->mergeOptions(array(array('path', null, InputOption::VALUE_OPTIONAL, 'Path to the language translations directory.', ''), array('template', null, InputOption::VALUE_OPTIONAL, 'Path to template.', GeneratorsServiceProvider::getTemplatePath('translations.txt')), array('lang', null, InputOption::VALUE_OPTIONAL, 'Path to template/lang scaffold directory.', '')));
 }
Пример #3
0
 /**
  * Grab down method stub and replace template vars
  *
  * @return string
  */
 protected function getDownStub()
 {
     switch ($this->action) {
         case 'add':
         case 'insert':
             // then we to remove columns in reverse
             $downMethod = $this->file->get(GeneratorsServiceProvider::getTemplatePath(self::$templatesDir, 'migration-down.txt'));
             $fields = $this->fields ? $this->setFields('dropColumn') : '';
             break;
         case 'remove':
         case 'drop':
         case 'delete':
             // then we need to add the columns in reverse
             $downMethod = $this->file->get(GeneratorsServiceProvider::getTemplatePath(self::$templatesDir, 'migration-down.txt'));
             $fields = $this->fields ? $this->setFields('addColumn') : '';
             break;
         case 'destroy':
             // then we need to create the table in reverse
             $downMethod = $this->file->get(GeneratorsServiceProvider::getTemplatePath(self::$templatesDir, 'migration-down-create.txt'));
             $fields = $this->fields ? $this->setFields('addColumn') : '';
             break;
         case 'create':
         case 'make':
         default:
             // then we need to drop the table in reverse
             $downMethod = $this->file->get(GeneratorsServiceProvider::getTemplatePath(self::$templatesDir, 'migration-down-drop.txt'));
             $fields = $this->fields ? $this->setFields('dropColumn') : '';
             break;
     }
     // Replace the tableName in the template
     $downMethod = str_replace('{{tableName}}', $this->tableName, $downMethod);
     // Insert the schema into the down method
     return str_replace('{{methods}}', $fields, $downMethod);
 }
Пример #4
0
 /**
  * Get the path to the template for a view.
  *
  * @return string
  */
 protected function getViewTemplatePath($view = 'view')
 {
     return GeneratorsServiceProvider::getTemplatePath($this->templateDirs, "views/{$view}.txt");
 }
Пример #5
0
 /**
  * Get a form template by name
  *
  * @param  string $type
  *
  * @return string
  */
 protected function getTemplate($type = 'list')
 {
     return $this->file->get(GeneratorsServiceProvider::getTemplatePath(static::$templatePath, "{$type}.txt"));
 }
Пример #6
0
 /**
  * Get the path to the template for a controller.
  *
  * @return string
  */
 protected function getTestTemplatePath()
 {
     return GeneratorsServiceProvider::getTemplatePath($this->templateDirs, 'controller-test.txt');
 }