Closed mrberggg closed 8 years ago
Please note that you should use Config::get instead of config() as this is not support in 4.2. This crashed our production application.
@ikanc Ah, good point. Do you want to put in a pull request?
@mrberggg Already did
The connections array is indexed by connection name and not by driver name. Shouldn't this be something like:
protected function getColumns()
{
if (array_key_exists('columns', $this->searchable)) {
// Get connection name instead of driver.
$key = $this->connection ?: Config::get('database.default');
$prefix = Config::get("database.connections.{$key}.prefix");
$columns = [];
foreach($this->searchable['columns'] as $column => $priority){
$columns[$prefix . $column] = $priority;
}
return $columns;
} else {
// Notice support for multi connections.
return DB::connection($this->connection)->getSchemaBuilder()->getColumnListing($this->table);
}
}
I also noticed that support for multiple connections was missing in this method.
Added code to prefix column names with the DB's prefix as defined in config/database.php.