Skip to content

Commit cc61e00

Browse files
committed
refactor has enum fields
1 parent 3c6073c commit cc61e00

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/Models/Traits/HasEnumFields.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ trait HasEnumFields
1515
{
1616
public static function getPossibleEnumValues($field_name)
1717
{
18-
$default_connection = Config::get('database.default');
19-
$table_prefix = Config::get('database.connections.'.$default_connection.'.prefix');
20-
2118
$instance = new static(); // create an instance of the model to be able to get the table name
22-
$connectionName = $instance->getConnectionName();
23-
$connection = DB::connection($connectionName);
19+
20+
$connection = $instance->getConnection();
21+
22+
$table_prefix = Config::get('database.connections.'.$connection->getName().'.prefix');
23+
2424
try {
2525
$select = app()->version() < 10 ?
2626
DB::raw('SHOW COLUMNS FROM `'.$table_prefix.$instance->getTable().'` WHERE Field = "'.$field_name.'"') :

0 commit comments

Comments
 (0)