farhan 3ヶ月前
コミット
d758f883ad
1個のファイルの変更8行の追加4行の削除
  1. 8
    4
      app/Http/Controllers/MainController.php

+ 8
- 4
app/Http/Controllers/MainController.php ファイルの表示

@@ -75,9 +75,11 @@ class MainController extends Controller
75 75
     {
76 76
         $vips = RSVP::where('is_vip', true)->get();
77 77
 
78
-        $csvData = "\xEF\xBB\xBF" . "Nama,Bilangan,No Tel\n";
78
+        $csvData = "\xEF\xBB\xBF" . "No,Nama,Bilangan,No Tel\n";
79
+        $count = 1;
79 80
         foreach ($vips as $vip) {
80
-            $csvData .= "\t{$vip->name},{$vip->member},\t{$vip->phone}\n";
81
+            $csvData .= "{$count},\t{$vip->name},{$vip->member},\t{$vip->phone}\n";
82
+            $count++;
81 83
         }
82 84
 
83 85
         $fileName = "vip_data.csv";
@@ -93,9 +95,11 @@ class MainController extends Controller
93 95
     {
94 96
         $generals = RSVP::where('is_vip', false)->get();
95 97
 
96
-        $csvData = "\xEF\xBB\xBF" . "Nama,Bilangan,No Tel\n";
98
+        $csvData = "\xEF\xBB\xBF" . "No,Nama,Bilangan,No Tel\n";
99
+        $count = 1;
97 100
         foreach ($generals as $general) {
98
-            $csvData .= "\t{$general->name},{$general->member},\t{$general->phone}\n";
101
+            $csvData .= "{$count},\t{$general->name},{$general->member},\t{$general->phone}\n";
102
+            $count++;
99 103
         }
100 104
 
101 105
         $fileName = "general_data.csv";

読み込み中…
キャンセル
保存