Skip to content

Commit 29a181f

Browse files
riesjarttaylorotwell
authored andcommitted
Change property name in Pivot class (#17933)
Make it possible to use ‘parent’ as a relation
1 parent dc8e17f commit 29a181f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • src/Illuminate/Database/Eloquent/Relations

src/Illuminate/Database/Eloquent/Relations/Pivot.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Pivot extends Model
1212
*
1313
* @var \Illuminate\Database\Eloquent\Model
1414
*/
15-
protected $parent;
15+
protected $pivotParent;
1616

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

6464
$this->exists = $exists;
6565

@@ -183,7 +183,7 @@ public function hasTimestampAttributes()
183183
*/
184184
public function getCreatedAtColumn()
185185
{
186-
return $this->parent->getCreatedAtColumn();
186+
return $this->pivotParent->getCreatedAtColumn();
187187
}
188188

189189
/**
@@ -193,6 +193,6 @@ public function getCreatedAtColumn()
193193
*/
194194
public function getUpdatedAtColumn()
195195
{
196-
return $this->parent->getUpdatedAtColumn();
196+
return $this->pivotParent->getUpdatedAtColumn();
197197
}
198198
}

0 commit comments

Comments
 (0)