Skip to content

Commit 9bd61e6

Browse files
Fixing a bug with the model's connection
`$this->connection` doesn't respect changes that may have occurred to the model's database connection. Multi-tenancy packages for example commonly change the model's connection.
1 parent cec58db commit 9bd61e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Kodeine/Metable/Metable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function setAttributes(array $attributes) {
351351
* @return boolean
352352
*/
353353
public function hasColumn($column) {
354-
if(empty(self::$_columnNames)) self::$_columnNames = array_map('strtolower',\Schema::connection($this->connection)->getColumnListing($this->getTable()));
354+
if(empty(self::$_columnNames)) self::$_columnNames = array_map('strtolower',\Schema::connection($this->getConnectionName())->getColumnListing($this->getTable()));
355355
return in_array(strtolower($column), self::$_columnNames);
356356
}
357357

0 commit comments

Comments
 (0)