Merge pull request #484 from kbanman/bugfix-pivot

Timestamps are optional in many-to-many pivot table
This commit is contained in:
Taylor Otwell 2012-04-04 08:36:01 -07:00
commit d1adc8c181
1 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class Has_Many_And_Belongs_To extends Relationship {
* *
* @var array * @var array
*/ */
protected $with = array('id', 'created_at', 'updated_at'); protected $with = array();
/** /**
* Create a new many to many relationship instance. * Create a new many to many relationship instance.
@ -43,6 +43,11 @@ public function __construct($model, $associated, $table, $foreign, $other)
$this->joining = $table ?: $this->joining($model, $associated); $this->joining = $table ?: $this->joining($model, $associated);
if (Pivot::$timestamps)
{
$this->with = array('id', 'created_at', 'updated_at');
}
parent::__construct($model, $associated, $foreign); parent::__construct($model, $associated, $foreign);
} }