UserModel.php
在我的用户模型中有created
事件,每次使用User::Save()
创建新用户时都会调用该事件
protected static function boot()
{
parent::boot();
self::created(function (User $user) {
// Some operation goes here
});
}
现在我想要的是由于某些原因我不想在创建新用户记录时调用created
。
有没有办法绕过createdEvent
?
在最近版本的Laravel中包含的模型上检查此withoutEvent
方法。 https://github.com/laravel/framework/blob/d4f89f9ca33c70672b0c5eeb0f9523a557841e69/CHANGELOG-5.7.md#v5726-2019-02-12