In ScriptSearch, I needed to make sure a transcript is fully searchable in Laravel Scout before I process it, as I need to rely on its search engine to properly locate fuzzy matches
Using Scout with queueing is great, but doing so doesn't give me a guarantee that it'll be fully indexed in time when I need it
To do this, I use raw inserts on the TranscriptLine model so Eloquent events aren't fired (preventing Scout from auto-importing them), along with a job chain to force-index the whole transcript first, and then subsequently process it
Laravel's job chaining is great for this, since the ProcessTranscript job will only be executed if the IndexTranscript job completes successfully
This is real code from the backend. I'll share more as I go, and hopefully some of you find it useful!