public function testGeneratesMultiColWithArgsAndDecorators()
 {
     $input = ['average' => ['type' => 'double', 'args' => '15,8', 'decorators' => ['nullable', 'default(10)']], 'age' => ['type' => 'integer']];
     $output = [];
     $output[] = "\$table->increments('id');";
     $output[] = "\$table->double('average', 15,8)->nullable()->default(10);";
     $output[] = "\$table->integer('age');";
     $output[] = "\$table->timestamps();";
     $this->assertEquals($output, MigrationColumnFactory::make($input));
 }
Exemplo n.º 2
0
 /**
  * Function to get the minimum template variables
  * 
  * @return array
  */
 public function getTemplateVars()
 {
     $entity = $this->getEntityName();
     $fieldData = $this->getFieldData();
     return ['Entity' => Str::studly($entity), 'Entities' => Str::plural(Str::studly($entity)), 'collection' => Str::plural(Str::snake($entity)), 'instance' => Str::singular(Str::snake($entity)), 'fields' => $fieldData, 'columns' => implode("\n\t\t\t", MigrationColumnFactory::make($fieldData)), 'migration_timestamp' => date('Y_m_d_His'), 'year' => (new DateTime())->format('Y')];
 }