How to temporarily disable Laravel Scout/Algolia in Laravel?

Updated on November 08,2022

Ever been in a situation where you quickly want to disable Laravel Scout in a Laravel application?

It could be for many reasons:

  • You have exhausted your Algolia quota, and your application is now breaking.
  • During testing.

Solution

Here is a quick fix.

Put in .env


SCOUT_DRIVER=algolia

Update config/Scout.php to: 

'driver' => env('SCOUT_DRIVER', 'null')

This way, when you remove the SCOUT_DRIVER variable from your environment file, it will default to null.



More in this category: Upvote/Downvote Weighted Ranking System in Laravel Using Bayesian Formula »