File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ public function cursor()
31
31
});
32
32
}
33
33
34
+ public function delete ()
35
+ {
36
+ $ this ->cache ($ this ->makeCacheTags ())
37
+ ->flush ();
38
+
39
+ return parent ::delete ();
40
+ }
41
+
34
42
/**
35
43
* @SuppressWarnings(PHPMD.ShortVariable)
36
44
*/
Original file line number Diff line number Diff line change @@ -660,4 +660,27 @@ public function testRawOrderByWithoutColumnReference()
660
660
$ this ->assertTrue ($ cachedResults ->diffAssoc ($ authors )->isEmpty ());
661
661
$ this ->assertTrue ($ liveResults ->diffAssoc ($ authors )->isEmpty ());
662
662
}
663
+
664
+ public function testDelete ()
665
+ {
666
+ $ author = (new Author )
667
+ ->first ();
668
+ $ liveResult = (new UncachedAuthor )
669
+ ->first ();
670
+ $ authorId = $ author ->id ;
671
+ $ liveResultId = $ liveResult ->id ;
672
+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor ' ;
673
+ $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
674
+
675
+ $ author ->delete ();
676
+ $ liveResult ->delete ();
677
+ $ cachedResult = cache ()
678
+ ->tags ($ tags )
679
+ ->get ($ key );
680
+ $ deletedAuthor = (new Author )->find ($ authorId );
681
+
682
+ $ this ->assertEquals ($ liveResultId , $ authorId );
683
+ $ this ->assertNull ($ cachedResult );
684
+ $ this ->assertNull ($ deletedAuthor );
685
+ }
663
686
}
You can’t perform that action at this time.
0 commit comments