Replies: 1 comment 4 replies
-
|
Adding code only for testing is bad style. You can mute events already: use App\Models\User;
$user = User::withoutEvents(function () {
User::findOrFail(1)->delete();
return User::find(2);
}); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was thinking about this for situations where there can be an observer that runs non important tasks that can make tests fail but we don't want to test that. In case the observer need to be tested it can be manually register with Model::observe().
Beta Was this translation helpful? Give feedback.
All reactions