skip to Main Content

Detecting when Laravel Dusk is running

Often in Laravel I need to detect the environment to avoid triggering certain code while running tests, like logging or sending an email: if (!app()->environment("testing")) { Mail::to($email)->queue(new WelcomeEmail($transaction->id)); } This works fine when the environment is set to testing in…

VIEW QUESTION
Back To Top
Search