How to disable scout when testing?


Hi everyone ,how to disable scout when testing? this <env name="SCOUT_DRIVER" value='"null"'/> doesn't work.
<env name="SCOUT_DRIVER" value="null"/> doesn't work also
if I add it into .env file it works but it would mean that each time I do testing or development I would have to switch it on and off.
 
You already invited:

evqan

Upvotes from:

try using config() method,

or you can use this code also,
 
public function setEnvironmentValue($envKey, $envValue)
{
$envFile = app()->environmentFilePath();
$str = file_get_contents($envFile);

$oldValue = strtok($str, "{$envKey}=");

$str = str_replace("{$envKey}={$oldValue}", "{$envKey}={$envValue}\n", $str);

$fp = fopen($envFile, 'w');
fwrite($fp, $str);
fclose($fp);
}

 
$this->setEnvironmentValue('SCOUT_DRIVER', ’NULL');

If you wanna answer this question please Login or Register