Skip to content

Commit a5a1f51

Browse files
committed
5.2.7
1 parent fb9fb33 commit a5a1f51

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,5 @@
162162
},
163163
"minimum-stability": "dev",
164164
"prefer-stable": true,
165-
"version": "5.2.6"
165+
"version": "5.2.7"
166166
}

src/Console/asset-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Console/card-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Console/field-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Console/filter-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Console/resource-tool-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Console/tool-stubs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/vendor
33
/node_modules
44
/auth.json
5-
package-lock.json
65
composer.phar
76
composer.lock
87
phpunit.xml

src/Fields/MorphTo.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,25 @@ public function fill(NovaRequest $request, object $model)
305305
{
306306
$instance = Nova::modelInstanceForKey($request->{$this->attribute.'_type'});
307307

308-
$morphType = $model->{$this->attribute}()->getMorphType();
308+
$relationship = $model->{$this->attribute}();
309309

310-
$model->{$morphType} = ! is_null($instance)
311-
? $this->getMorphAliasForClass(get_class($instance))
312-
: null;
310+
$morphType = $relationship->getMorphType();
313311

314-
$foreignKey = $this->getRelationForeignKeyName($model->{$this->attribute}());
312+
$model->setAttribute(
313+
$morphType,
314+
! is_null($instance) ? $this->getMorphAliasForClass($instance::class) : null
315+
);
316+
317+
$foreignKey = $this->getRelationForeignKeyName($relationship);
315318

316-
if ($model->isDirty([$morphType, $foreignKey])) {
317-
$model->unsetRelation($this->attribute);
318-
}
319-
320319
parent::fillInto($request, $model, $foreignKey);
321320

322-
if (is_null($model->{$this->attribute.'_type'})) {
323-
$model->{$this->attribute.'_id'} = null;
321+
if (is_null($model->getAttribute($morphType))) {
322+
$model->setAttribute($foreignKey, null);
323+
}
324+
325+
if ($model->isDirty([$morphType, $foreignKey])) {
326+
$model->unsetRelation($this->attribute);
324327
}
325328
}
326329

0 commit comments

Comments
 (0)