Skip to content

Commit 6ba1b83

Browse files
authored
avoid duplicates in fillable/guarded on merge (#47351)
1 parent 0f0352e commit 6ba1b83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function fillable(array $fillable)
6363
*/
6464
public function mergeFillable(array $fillable)
6565
{
66-
$this->fillable = array_merge($this->fillable, $fillable);
66+
$this->fillable = array_values(array_unique(array_merge($this->fillable, $fillable)));
6767

6868
return $this;
6969
}
@@ -101,7 +101,7 @@ public function guard(array $guarded)
101101
*/
102102
public function mergeGuarded(array $guarded)
103103
{
104-
$this->guarded = array_merge($this->guarded, $guarded);
104+
$this->guarded = array_values(array_unique(array_merge($this->guarded, $guarded)));
105105

106106
return $this;
107107
}

0 commit comments

Comments
 (0)