在我的模型中,我有一个方法可以将索引更新为引导代码的一部分:
protected static function booted()
{
static::saved(function ($mpi) {
$mpi->updateFulltextSelf();
});
}
但是,我发现当我需要更新很多模型时,这会导致Serialization Deadlock (1213)MySql中出现a,所以我想要求laravel避免运行这个方法。我试过没有成功:
$eventDispatcher = Mpi::getEventDispatcher();
$eventDispatcher->forget('eloquent.saved: ' . Mpi::class);
还有什么作用?