private buildSchemaColumn ( string $fieldType, string $name, integer $length, array $traits = [] ) : string | ||
$fieldType | string | The type of column to create |
$name | string | Name of the column to create |
$length | integer | Field length |
$traits | array | Additional properties to apply to the column |
Результат | string |
private function buildSchemaColumn($fieldType, $name, $length = 0, $traits = [])
{
return sprintf("\$table->%s('%s'%s)%s;" . PHP_EOL . ' ', $fieldType, $name, $length > 0 ? ", {$length}" : '', implode('', array_map(function ($trait) {
return '->' . $trait . '()';
}, $traits)));
}