Fix bug with many-to-many relationships on non-default database connection.
This commit is contained in:
@@ -20,11 +20,13 @@ class Pivot extends Model {
|
||||
* Create a new pivot table instance.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $connection
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($table)
|
||||
public function __construct($table, $connection = null)
|
||||
{
|
||||
$this->pivot_table = $table;
|
||||
$this->connection = $connection;
|
||||
|
||||
parent::__construct(array(), true);
|
||||
}
|
||||
@@ -39,4 +41,14 @@ class Pivot extends Model {
|
||||
return $this->pivot_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection used by the pivot table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function connection()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user