Skip to content

Commit 327691c

Browse files
authored
Fix issues with $fillable
When using $guarded = ['id'] instead of $fillable, there is no need to add attributes to the $fillable array. This resolves issues I encountered while using $guarded = ['id'] on my model.
1 parent 10d6f93 commit 327691c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Concern/ModelTree.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ trait ModelTree
1616

1717
public function initializeModelTree()
1818
{
19-
$this->fillable[] = $this->determineOrderColumnName();
20-
$this->fillable[] = $this->determineParentColumnName();
21-
$this->fillable[] = $this->determineTitleColumnName();
19+
if (!empty($this->fillable)) {
20+
$this->mergeFillable([
21+
$this->determineOrderColumnName(),
22+
$this->determineParentColumnName(),
23+
$this->determineTitleColumnName(),
24+
]);
25+
}
2226
}
2327

2428
/**

0 commit comments

Comments
 (0)