2 years ago

Update Scout index on cascade deleted models

Posted 2 years ago by lmartins

I have a situation where I have two models: User and Purchase. The Purchase model is indexed via Scout and pushed to Algolia.

The purchase is setup so that when a user is deleted, the associated purchases are also removed from the BD:

        Schema::create('purchases', function (Blueprint $table) {

Problem is when the user is deleted even though the purchase is removed from the DB, it stays indexed in Algolia. Am I missing any step?


Please sign in or create an account to participate in this conversation.