Skip to content

Commit

Permalink
Change property name in Pivot class (#17933)
Browse files Browse the repository at this point in the history
Make it possible to use ‘parent’ as a relation
  • Loading branch information
riesjart authored and taylorotwell committed Feb 15, 2017
1 parent dc8e17f commit 29a181f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Eloquent/Relations/Pivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Pivot extends Model
*
* @var \Illuminate\Database\Eloquent\Model
*/
protected $parent;
protected $pivotParent;

/**
* The name of the foreign key column.
Expand Down Expand Up @@ -59,7 +59,7 @@ public function __construct(Model $parent, $attributes, $table, $exists = false)
// We store off the parent instance so we will access the timestamp column names
// for the model, since the pivot model timestamps aren't easily configurable
// from the developer's point of view. We can use the parents to get these.
$this->parent = $parent;
$this->pivotParent = $parent;

$this->exists = $exists;

Expand Down Expand Up @@ -183,7 +183,7 @@ public function hasTimestampAttributes()
*/
public function getCreatedAtColumn()
{
return $this->parent->getCreatedAtColumn();
return $this->pivotParent->getCreatedAtColumn();
}

/**
Expand All @@ -193,6 +193,6 @@ public function getCreatedAtColumn()
*/
public function getUpdatedAtColumn()
{
return $this->parent->getUpdatedAtColumn();
return $this->pivotParent->getUpdatedAtColumn();
}
}

0 comments on commit 29a181f

Please sign in to comment.