service->index($request->all()); return view('admin.members.marketing', $data); } public function export(Request $request) { $data = $request->validate([ 'zip_password' => ['required', 'string', 'min:4', 'max:64'], // filters 'qf' => ['nullable','string','in:all,mem_no,name,email,phone'], 'q' => ['nullable','string','max:100'], 'stat_3' => ['nullable','string','in:1,2,3,4,5,6'], 'reg_from' => ['nullable','date'], 'reg_to' => ['nullable','date'], 'no_login' => ['nullable','string','in:0,1'], 'inactive_days_gte' => ['nullable','integer','min:0','max:36500'], 'has_purchase' => ['nullable','string','in:all,1,0'], 'recent_purchase' => ['nullable','string','in:all,30,90'], 'min_purchase_count' => ['nullable','integer','min:0','max:999999'], 'min_purchase_amount' => ['nullable','integer','min:0','max:999999999999'], // 추가 옵션(접기 영역) 'optin_sms' => ['nullable','string','in:all,1,0'], 'optin_email' => ['nullable','string','in:all,1,0'], 'has_phone' => ['nullable','string','in:all,1,0'], 'has_email' => ['nullable','string','in:all,1,0'], ]); $zipPassword = (string) $data['zip_password']; unset($data['zip_password']); $res = $this->service->exportZip($data, $zipPassword); if (!($res['ok'] ?? false)) { return redirect()->back()->with('toast', [ 'type' => 'danger', 'title' => '다운로드 실패', 'message' => $res['message'] ?? '파일 생성에 실패했습니다.', ]); } return response() ->download($res['zip_path'], $res['download_name']) ->deleteFileAfterSend(true); } }