File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 2020use Closure ;
2121use Exception ;
2222use Illuminate \Contracts \Mail \Mailable ;
23+ use Illuminate \Database \Eloquent \Builder ;
2324use Illuminate \Database \Eloquent \Model ;
2425use Illuminate \Database \Eloquent \Relations \HasMany ;
2526use Illuminate \Support \Arr ;
@@ -373,10 +374,6 @@ public function shouldSend(): bool
373374
374375 public function executeWhenPasses (bool $ now = false ): void
375376 {
376- if (! $ this ->save ()) {
377- return ;
378- }
379-
380377 if ($ this ->shouldSend ()) {
381378 $ this ->execute ($ now );
382379 }
@@ -586,6 +583,9 @@ public function save(array $options = [])
586583 ->targetableId ($ this ->targetable_id )
587584 ->mailableClass ($ mailable )
588585 ->where ('name ' , $ this ->name )
586+ ->when ($ this ->getKey (), function (Builder $ q ) {
587+ $ q ->where ($ this ->getKeyName (), '!= ' , $ this ->getKey ());
588+ })
589589 ->exists ();
590590
591591 if ($ exists ) {
You can’t perform that action at this time.
0 commit comments