@@ -377,25 +377,28 @@ public function enumValues($model, $table, $name)
377
377
return "[] " ;
378
378
}
379
379
380
- $ driver = $ model ->getConnection ()->getDriverName ();
380
+ $ connection = $ model ->getConnection ();
381
+ $ driver = $ connection ->getDriverName ();
381
382
$ values = null ;
382
383
383
384
if ($ driver === 'mysql ' ) {
384
- $ type = DB ::select (DB ::raw ('SHOW COLUMNS FROM ' . $ table . ' WHERE Field = " ' . $ name . '" ' ))[0 ]->Type ;
385
+ $ type = DB ::connection ($ connection )
386
+ ->select (DB ::raw ('SHOW COLUMNS FROM ' . $ table . ' WHERE Field = " ' . $ name . '" ' ))[0 ]->Type ;
385
387
386
388
preg_match_all ("/'([^']+)'/ " , $ type , $ matches );
387
389
388
390
$ values = isset ($ matches [1 ]) ? $ matches [1 ] : array ();
389
391
390
392
return "[' " . implode ("', ' " , $ values ) . "'] " ;
391
393
} else if ($ driver === 'pgsql ' ) {
392
- $ types = DB ::select (DB ::raw ("
393
- select matches[1]
394
- from pg_constraint, regexp_matches(consrc, '''(.+?)''', 'g') matches
395
- where contype = 'c'
396
- and conname = ' {$ table }_ {$ name }_check'
397
- and conrelid = 'public. {$ table }'::regclass;
398
- " ));
394
+ $ types = DB ::connection ($ connection )
395
+ ->select (DB ::raw ("
396
+ select matches[1]
397
+ from pg_constraint, regexp_matches(consrc, '''(.+?)''', 'g') matches
398
+ where contype = 'c'
399
+ and conname = ' {$ table }_ {$ name }_check'
400
+ and conrelid = 'public. {$ table }'::regclass;
401
+ " ));
399
402
400
403
$ values = array ();
401
404
0 commit comments