Skip to content

Commit b725aba

Browse files
committed
replace array_merge with array unpacking
1 parent c747462 commit b725aba

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Relations/MorphToMany.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ protected function setWhere()
8585
}
8686

8787
/** @inheritdoc */
88-
public function save(Model $model, array $joining = [], $touch = true)
88+
public function save(Model $model, array $pivotAttributes = [], $touch = true)
8989
{
9090
$model->save(['touch' => false]);
9191

92-
$this->attach($model, $joining, $touch);
92+
$this->attach($model, $pivotAttributes, $touch);
9393

9494
return $model;
9595
}
@@ -272,12 +272,13 @@ public function detach($ids = [], $touch = true)
272272
// Remove the relation from the parent.
273273
$data = [];
274274
foreach ($ids as $item) {
275-
$data = array_merge($data, [
275+
$data = [
276+
...$data,
276277
[
277278
$this->relatedPivotKey => $item,
278-
$this->morphType => $this->related->getMorphClass(),
279+
$this->morphType => $this->related->getMorphClass(),
279280
],
280-
]);
281+
];
281282
}
282283

283284
$this->parent->pull($this->table, $data);
@@ -378,8 +379,8 @@ protected function whereInMethod(Model $model, $key)
378379
/**
379380
* Extract ids from given pivot table data
380381
*
381-
* @param array $data
382-
* @param string|null $relatedPivotKey
382+
* @param array $data
383+
* @param string|null $relatedPivotKey
383384
*
384385
* @return mixed
385386
*/

0 commit comments

Comments
 (0)