Skip to content

Commit

Permalink
no need to add dynamic property
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Mar 27, 2024
1 parent 6ee2a55 commit 9d2fa6d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions classes/TranslatableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ public function __construct($model)

$this->initTranslatableContext();

if (! isset($model->translatable)) {
$model->addDynamicProperty('translatable', []);
}

$this->model->bindEvent('model.beforeGetAttribute', function ($key) use ($model) {
if ($this->isTranslatable($key)) {
$value = $this->getAttributeTranslated($key);
Expand Down Expand Up @@ -380,7 +376,7 @@ public function getTranslatableAttributes()
{
$translatable = [];

foreach ($this->model->translatable as $attribute) {
foreach ($this->model->translatable ?? [] as $attribute) {
$translatable[] = is_array($attribute) ? array_shift($attribute) : $attribute;
}

Expand Down

0 comments on commit 9d2fa6d

Please sign in to comment.