File tree Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ public function excluded(): bool
5151
5252 public function addToExclusion (): bool
5353 {
54+ if ($ this ->excluded ()) {
55+ return true ;
56+ }
57+
5458 if ($ this ->fireModelEvent ('excluding ' ) === false ) {
5559 return false ;
5660 }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function addConstraints(): void
3434 ->whereNotNull ($ this ->foreignKey )
3535 ->where (
3636 fn (Builder $ query ) => $ query
37- ->where ($ this ->foreignKey , $ this ->getParentKey ())
37+ ->where ($ this ->foreignKey , ( string ) $ this ->getParentKey ())
3838 ->orWhere ($ this ->foreignKey , '* ' )
3939 );
4040 }
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function addConstraints(): void
3535 ->whereNotNull ($ this ->foreignKey )
3636 ->where (
3737 fn (Builder $ query ) => $ query
38- ->where ($ this ->foreignKey , $ this ->getParentKey ())
38+ ->where ($ this ->foreignKey , ( string ) $ this ->getParentKey ())
3939 ->orWhere ($ this ->foreignKey , '* ' )
4040 );
4141 }
Original file line number Diff line number Diff line change @@ -104,6 +104,8 @@ public function it_can_exclude_all_models()
104104
105105 Article::excludeAllModels ();
106106
107+ $ articles ->first ()->addToExclusion ();
108+
107109 $ this ->assertCount (0 , Article::all ());
108110 $ this ->assertDatabaseCount ($ this ->exclusionsTable , 1 );
109111 $ this ->assertDatabaseHas ($ this ->exclusionsTable , [
You can’t perform that action at this time.
0 commit comments