alias = $alias; $this->path = $path; } /** * Execute the job. * * @return string */ public function handle() { if (empty($this->path)) { throw new \Exception(trans('modules.errors.unzip', ['module' => $this->alias])); } $temp_path = storage_path('app/temp/' . $this->path); $file = $temp_path . '/upload.zip'; // Unzip the file $zip = new ZipArchive(); if (!$zip->open($file) || !$zip->extractTo($temp_path)) { throw new \Exception(trans('modules.errors.unzip', ['module' => $this->alias])); } $zip->close(); // Remove Zip File::delete($file); return $this->path; } }