filepath = $filepath; $this->user = $user; $this->company = $company; } /** * Execute the job. * * @return void */ public function handle() { MultiDB::setDb($this->company->db); $zip = new \ZipArchive(); $archive = $zip->open($this->filepath); $filename = pathinfo($this->filepath, PATHINFO_FILENAME); try { if ($archive) { $zip->extractTo(storage_path("migrations/{$filename}")); $zip->close(); } else { throw new ProcessingMigrationArchiveFailed(); } } catch (ProcessingMigrationArchiveFailed $e) { // TODO: Break the code, stop the migration.. send an e-mail. } // Rest of the migration.. } }