. */ namespace App\Jobs; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Bus\Queueable; abstract class Job { /* |-------------------------------------------------------------------------- | Queueable Jobs |-------------------------------------------------------------------------- | | This job base class provides a central location to place any logic that | is shared across all of your jobs. The trait included with the class | provides access to the "queueOn" and "delay" queue helper methods. | */ use Queueable; /** * This method should be called at the beginning of every job's handle() * method. It ensures that we don't lose the in-memory database during * testing by disconnecting from it - which causes tests to fail. */ protected function beforeHandle() { if (App::environment() !== 'testing') { DB::reconnect(); } } }