Skip to content

Commit c102fc3

Browse files
authored
Merge pull request buildwithyab#40 from CasperLaiTW/get-columns-from-builder
Get columns from builder
2 parents 7f15c39 + edf9c05 commit c102fc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Services/ModelService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ protected function getAllFields()
6363
$columns = [];
6464

6565
//@TODO cache this
66-
foreach (DB::connection($this->connectionName)->select("SHOW COLUMNS FROM $this->tableName") as $column) {
67-
$columns[$column->Field] = null;
66+
foreach (DB::connection($this->connectionName)->getSchemaBuilder()->getColumnListing($this->tableName) as $column) {
67+
$columns[$column] = null;
6868
}
6969

7070
return $columns;

0 commit comments

Comments
 (0)