|
@@ -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([
|