formatting
This commit is contained in:
parent
f9206fd7ce
commit
39af10ff95
|
@ -72,15 +72,8 @@ class SettingsController extends Controller
|
||||||
return redirect()->route('admin.settings.index')->with('success', 'Invoice settings updated!');
|
return redirect()->route('admin.settings.index')->with('success', 'Invoice settings updated!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rglob($pattern, $flags = 0) {
|
public function downloadAllInvoices()
|
||||||
$files = glob($pattern, $flags);
|
{
|
||||||
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
|
|
||||||
$files = array_merge($files, $this::rglob($dir.'/'.basename($pattern), $flags));
|
|
||||||
}
|
|
||||||
return $files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function downloadAllInvoices(){
|
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$zip_safe_path = storage_path('invoices.zip');
|
$zip_safe_path = storage_path('invoices.zip');
|
||||||
$res = $zip->open($zip_safe_path, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
$res = $zip->open($zip_safe_path, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||||
|
@ -94,11 +87,16 @@ class SettingsController extends Controller
|
||||||
}
|
}
|
||||||
$zip->close();
|
$zip->close();
|
||||||
}
|
}
|
||||||
if (file_exists($zip_safe_path) && is_file($zip_safe_path)) {
|
|
||||||
return response()->download($zip_safe_path);
|
return response()->download($zip_safe_path);
|
||||||
}else{
|
|
||||||
$this->index()->with('failure', 'No Invoices in Storage!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function rglob($pattern, $flags = 0)
|
||||||
|
{
|
||||||
|
$files = glob($pattern, $flags);
|
||||||
|
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
|
||||||
|
$files = array_merge($files, $this::rglob($dir . '/' . basename($pattern), $flags));
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue