浏览代码

Update model observers, handle events after all transactions are committed

Daniel Supernault 2 年之前
父节点
当前提交
78665b0c17

+ 7 - 0
app/Observers/AvatarObserver.php

@@ -9,6 +9,13 @@ use App\Services\AccountService;
 
 
 class AvatarObserver
 class AvatarObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the avatar "created" event.
      * Handle the avatar "created" event.
      *
      *

+ 7 - 0
app/Observers/LikeObserver.php

@@ -7,6 +7,13 @@ use App\Services\LikeService;
 
 
 class LikeObserver
 class LikeObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the Like "created" event.
      * Handle the Like "created" event.
      *
      *

+ 7 - 0
app/Observers/ModLogObserver.php

@@ -9,6 +9,13 @@ use Log;
 
 
 class ModLogObserver
 class ModLogObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the mod log "created" event.
      * Handle the mod log "created" event.
      *
      *

+ 7 - 0
app/Observers/NotificationObserver.php

@@ -7,6 +7,13 @@ use App\Services\NotificationService;
 
 
 class NotificationObserver
 class NotificationObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the notification "created" event.
      * Handle the notification "created" event.
      *
      *

+ 7 - 0
app/Observers/ProfileObserver.php

@@ -7,6 +7,13 @@ use App\Services\AccountService;
 
 
 class ProfileObserver
 class ProfileObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the Profile "created" event.
      * Handle the Profile "created" event.
      *
      *

+ 7 - 0
app/Observers/StatusHashtagObserver.php

@@ -7,6 +7,13 @@ use App\Services\StatusHashtagService;
 
 
 class StatusHashtagObserver
 class StatusHashtagObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
     /**
     /**
      * Handle the notification "created" event.
      * Handle the notification "created" event.
      *
      *

+ 7 - 0
app/Observers/UserFilterObserver.php

@@ -7,6 +7,13 @@ use App\Services\UserFilterService;
 
 
 class UserFilterObserver
 class UserFilterObserver
 {
 {
+    /**
+     * Handle events after all transactions are committed.
+     *
+     * @var bool
+     */
+    public $afterCommit = true;
+
 	/**
 	/**
 	 * Handle the user filter "created" event.
 	 * Handle the user filter "created" event.
 	 *
 	 *