-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Dispatch events based on a DB transaction result (#48705)
* wip * Refactor * Add EventFake support * remove strict types * Make styleCI happy * Fix test * Add missing test for EventFake * Add test to handle nested transactions * fix typo * Make styleci happy * formatting, inject manager resolver * formatting * formatting * formatting * formatting * more thorough solution * Add additional test for nested transactions * Add additional nested transaction test --------- Co-authored-by: Taylor Otwell <[email protected]>
- Loading branch information
1 parent
c55667a
commit 0525a88
Showing
12 changed files
with
383 additions
and
9 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/Illuminate/Contracts/Events/ShouldDispatchAfterCommit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Illuminate\Contracts\Events; | ||
|
||
interface ShouldDispatchAfterCommit | ||
{ | ||
// | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Illuminate/Contracts/Events/ShouldHandleEventsAfterCommit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Illuminate\Contracts\Events; | ||
|
||
interface ShouldHandleEventsAfterCommit | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Illuminate\Contracts\Queue; | ||
|
||
interface ShouldQueueAfterCommit extends ShouldQueue | ||
{ | ||
// | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Illuminate/Database/Eloquent/BroadcastsEventsAfterCommit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database\Eloquent; | ||
|
||
trait BroadcastsEventsAfterCommit | ||
{ | ||
use BroadcastsEvents; | ||
|
||
/** | ||
* Determine if the model event broadcast queued job should be dispatched after all transactions are committed. | ||
* | ||
* @return bool | ||
*/ | ||
public function broadcastAfterCommit() | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.