current(); if (! $tenant) abort(404); // Re-fetch via central scope to avoid issues. $company = Company::withoutGlobalScopes()->find($tenant->id); if (! $company) abort(404); $svc = app(TenantBackupService::class); $file = $svc->export($company); $filename = $svc->filename($company); return response()->download($file, $filename, [ 'Content-Type' => 'application/zip', ])->deleteFileAfterSend(); } }