Created
November 18, 2018 16:09
-
-
Save VitalyKondratiev/c3928172f00a508665dabb7f2d7043b0 to your computer and use it in GitHub Desktop.
Экстрактор JetBrains DataGrip для создания Laravel Seeds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LINE_FEED = "\n"; | |
var LINE_TABULATION = "\t"; | |
var TABLE_NAME = (TABLE !== null ) ? TABLE.getName() : 'table'; | |
function output() { | |
for (var i = 0; i < arguments.length; i++) { | |
OUT.append(arguments[i]); | |
} | |
} | |
var rowIterator = ROWS.iterator(); | |
while (rowIterator.hasNext()) { | |
var row = rowIterator.next(); | |
output("DB::table('", TABLE_NAME, "')->insert([", LINE_FEED); | |
var columnIterator = COLUMNS.iterator(); | |
while (columnIterator.hasNext()) { | |
var column = columnIterator.next(); | |
output(LINE_TABULATION, "'", column.name(), "' =\> '", FORMATTER.format(row, column), "',", LINE_FEED); | |
} | |
output("]);", LINE_FEED); | |
if (rowIterator.hasNext()) { | |
output(LINE_FEED); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment