app/src/Console/Commands/GenerateModelCommand.php 1 location
|
@@ 55-61 (lines=7) @@
|
52 |
|
} |
53 |
|
|
54 |
|
$columns = []; |
55 |
|
foreach ($table as $columnName) { |
56 |
|
$columnType = Capsule::schema()->getColumnType($tableName, $columnName); |
57 |
|
$columns[] = [ |
58 |
|
'name' => $columnName, |
59 |
|
'type' => $columnType !== 'datetime' ? $columnType : '\Carbon\Carbon', |
60 |
|
]; |
61 |
|
} |
62 |
|
|
63 |
|
$modelName = substr($tableName, 0, -1); |
64 |
|
$className = Helper::underscoreToCamelCase($modelName, true); |
app/src/Console/Commands/GenerateSchemaCommand.php 1 location
|
@@ 93-101 (lines=9) @@
|
90 |
|
private function getColumnsInfo($tableInfo, $tableName) |
91 |
|
{ |
92 |
|
$columns = []; |
93 |
|
foreach ($tableInfo as $columnName) { |
94 |
|
$columnType = Capsule::schema()->getColumnType($tableName, $columnName); |
95 |
|
|
96 |
|
$columns[] = [ |
97 |
|
'name' => $columnName, |
98 |
|
'type' => $columnType, |
99 |
|
'fake' => $this->getFakeData($columnType), |
100 |
|
]; |
101 |
|
} |
102 |
|
|
103 |
|
return $columns; |
104 |
|
} |