From 07e398ba8df92c733124e4bb7e310b9f8d5be171 Mon Sep 17 00:00:00 2001 From: Ivan Yeoh Date: Mon, 6 Jul 2020 10:11:27 +0800 Subject: [PATCH 1/3] support laravel 6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0bf9048..9df9b48 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Laravel has many sync", "type": "library", "require": { - "illuminate/support": "~5.4" + "illuminate/support": "^6.2" }, "license": "MIT", "authors": [ From 839d207dd82b9a8ecf17c8fb6087197c09bf18df Mon Sep 17 00:00:00 2001 From: sto-calcueasy <66617389+sto-calcueasy@users.noreply.github.com> Date: Wed, 14 Oct 2020 11:37:54 +0200 Subject: [PATCH 2/3] When updating related entities, Eloquent events such as `saved` and `updated` are NOT fired. When using the `update()` method without retrieving the entity first, the Laravel events `updating`, `updated`, `saving` and `saved` are not fired. I noticed this when I was working on an `Event` for my application and I was wondering why the saved event was only fired when a new related entity is added, but it is not fired when an existing entity is edited. --- src/ServiceProvider.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index e86b5f0..b909db7 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -72,8 +72,11 @@ public function boot() } foreach ($updatedRows as $row) { - $this->getRelated()->where($relatedKeyName, $castKey(array_get($row, $relatedKeyName))) - ->update($row); + $related = $this->getRelated() + ->where($relatedKeyName, $castKey(array_get($row, $relatedKeyName))) + ->first() + ->fill($row) + ->save(); } $changes['updated'] = $castKeys(array_pluck($updatedRows, $relatedKeyName)); From 9ac37fe99fb2628fef79922cfc005d614ed30339 Mon Sep 17 00:00:00 2001 From: sto-calcueasy <66617389+sto-calcueasy@users.noreply.github.com> Date: Sat, 31 Oct 2020 10:34:21 +0100 Subject: [PATCH 3/3] Update composer.json Need to update composer.json requirements to allow laravel 7 upgrade. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9df9b48..4aa3e97 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Laravel has many sync", "type": "library", "require": { - "illuminate/support": "^6.2" + "illuminate/support": "^7.0" }, "license": "MIT", "authors": [