Chumper\Zipper\Zipper::close PHP Метод

close() публичный Метод

Closes the zip file and frees all handles
public close ( )
    public function close()
    {
        if (!is_null($this->repository)) {
            $this->repository->close();
        }
        $this->filePath = "";
    }

Usage Example

Пример #1
0
 public function getJust($idCarga)
 {
     $carga = Cargas::find($idCarga);
     if ($carga) {
         //obtener cargas
         $empresa = $carga->empresa()->orderBy('tipo_receptor')->get();
         $sat = $carga->sat()->orderBy('tipo_receptor')->get();
         $diff = new DiferenciasCFID($sat, $empresa, $carga->rfc);
         $just_emitidos = $diff->get_justificados_emitidos();
         $just_recibidos = $diff->get_justificados_recibidos();
         $array = ['rfc' => $carga->rfc, 'nombre' => $carga->contribuyente->nombre, 'justEm' => $just_emitidos, 'justRec' => $just_recibidos];
         $namePdf = $carga->rfc . "_" . time() . ".pdf";
         \PDF::loadView('descargas.reporte-justificados', $array)->save(storage_path('temp') . "/{$namePdf}");
         $nameZip = "just_" . time() . ".zip";
         $zipper = new Zipper();
         $zipper->make(storage_path("temp/{$nameZip}"))->add(storage_path('temp') . "/{$namePdf}");
         $anexos = $diff->getAnexos();
         foreach ($anexos as $anexo) {
             $zipper->folder($anexo['uuid']);
             foreach ($anexo['anexos'] as $file) {
                 $zipper->add($file->file);
             }
         }
         $zipper->close();
         return response()->download(storage_path("temp/{$nameZip}"), $nameZip);
     }
 }
All Usage Examples Of Chumper\Zipper\Zipper::close