Browse Source

add indicator is_vip

master
farhan 5 months ago
parent
commit
fffa688e77

+ 10
- 10
app/Http/Controllers/MainController.php View File

@@ -14,23 +14,23 @@ class MainController extends Controller
14 14
         $totalPages = $guestbooks->count();
15 15
 
16 16
         $host = $request->getHost();
17
-        // if ($host == 'aliffayuna.com') {
18
-        //     return view('digital-card', compact(['rsvp', 'guestbooks', 'totalPages', 'host']));
19
-        // } else if ($host == 'rsvp.aliffayuna.com') {
20
-        //     return view('rsvp-digital-card');
21
-        // } else {
22
-        //     return view('digital-card', compact(['rsvp', 'guestbooks', 'totalPages', 'host']));
23
-        //     // return view('rsvp-digital-card');
24
-        // }
25 17
 
26 18
         return view('digital-card', compact(['rsvp', 'guestbooks', 'totalPages', 'host']));
27 19
     }
28 20
 
29 21
     public function saveRsvp(Request $request) {
22
+        $host = $request->getHost();
23
+
24
+        if ($host == 'rsvp.aliffayuna.com') {
25
+            $vip = true;
26
+        } else {
27
+            $vip = false;
28
+        }
30 29
         RSVP::create([
31 30
             'name' => $request->name,
32 31
             'member' => $request->member,
33
-            'phone' => $request->phone
32
+            'phone' => $request->phone,
33
+            'is_vip' => $vip
34 34
         ]);
35 35
 
36 36
         session()->flash('success', 'Terima kasih kerana sudi menghadirkan diri!');
@@ -51,7 +51,7 @@ class MainController extends Controller
51 51
 
52 52
     public function fetchGuestbook(Request $request)
53 53
     {
54
-        $page = $request->input('page', 1); // Default to page 1 if no page is provided
54
+        $page = $request->input('page', 1);
55 55
         $guestbook = GuestBook::orderBy('created_at', 'desc')->take(5)->get()->forPage($page, 1);
56 56
 
57 57
         return response()->json([

+ 2
- 1
app/Models/RSVP.php View File

@@ -14,6 +14,7 @@ class RSVP extends Model
14 14
     protected $fillable = [
15 15
         'name',
16 16
         'member',
17
-        'phone'
17
+        'phone',
18
+        'is_vip'
18 19
     ];
19 20
 }

+ 28
- 0
database/migrations/2024_07_16_215415_add_indicator_column_in_rsvp.php View File

@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+return new class extends Migration
8
+{
9
+    /**
10
+     * Run the migrations.
11
+     */
12
+    public function up(): void
13
+    {
14
+        Schema::table('rsvps', function (Blueprint $table) {
15
+            $table->boolean('is_vip')->nullable()->after('name');
16
+        });
17
+    }
18
+
19
+    /**
20
+     * Reverse the migrations.
21
+     */
22
+    public function down(): void
23
+    {
24
+        Schema::table('rsvps', function (Blueprint $table) {
25
+            $table->dropColumn('is_vip');
26
+        });
27
+    }
28
+};

+ 1
- 1
resources/views/modals/rsvp-modal.blade.php View File

@@ -20,7 +20,7 @@
20 20
                 <span class="label-text">No. Tel</span>
21 21
             </div>
22 22
             <input type="number" name="phone" placeholder="Taip disini" class="input input-bordered input-sm input-accent w-full max-w-xs" />
23
-        </label>
23
+          </label>
24 24
       </form>
25 25
       <div class="modal-action">
26 26
           <form method="dialog" id="closeRsvpForm"></form>

Loading…
Cancel
Save