update
This commit is contained in:
@@ -81,20 +81,19 @@ class JsonTransferController extends Controller
|
|||||||
|
|
||||||
return response()->download($file);
|
return response()->download($file);
|
||||||
}
|
}
|
||||||
public function downloadAll(){
|
public function downloadAll()
|
||||||
$zipFile = base_path('database/seeders/data/all_json.zip');
|
{
|
||||||
$zip = new ZipArchive;
|
$targetDir = base_path('database/seeders/data/');
|
||||||
|
$zipFile = $targetDir . 'all_json.zip';
|
||||||
File::delete($zipFile);
|
if (file_exists($zipFile)) {
|
||||||
|
File::delete($zipFile);
|
||||||
if ($zip->open($zipFile, ZipArchive::CREATE) === TRUE) {
|
|
||||||
foreach (File::files(base_path($this->exportPath)) as $file) {
|
|
||||||
$zip->addFile($file->getRealPath(), basename($file));
|
|
||||||
}
|
|
||||||
$zip->close();
|
|
||||||
}
|
}
|
||||||
|
$command = "cd {$targetDir} && zip -r all_json.zip .";
|
||||||
return response()->download($zipFile);
|
shell_exec($command);
|
||||||
|
if (file_exists($zipFile)) {
|
||||||
|
return response()->download($zipFile);
|
||||||
|
}
|
||||||
|
return back()->with('error', 'Gagal membuat file ZIP.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function importTable($table) {
|
public function importTable($table) {
|
||||||
|
|||||||
Reference in New Issue
Block a user