123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
-
- namespace App\Http\Controllers;
-
- use Illuminate\Http\Request;
- use App\Models\RSVP;
- use App\Models\GuestBook;
-
- class MainController extends Controller
- {
- public function main(Request $request) {
- $rsvp = RSVP::all();
- $guestbook = GuestBook::all();
-
- $currentUrl = $request->fullUrl();
- if ($currentUrl == 'https://aliffayuna.com/') {
- return view('digital-card', compact(['rsvp', 'guestbook']));
- }
-
- if ($currentUrl == 'https://rsvp.aliffayuna.com/') {
- return view('rsvp-digital-card', compact(['rsvp', 'guestbook']));
- }
- }
-
- public function saveRsvp(Request $request) {
- RSVP::create([
- 'name' => $request->name,
- 'member' => $request->member,
- 'phone' => $request->phone
- ]);
-
- session()->flash('success', 'Terima kasih kerana sudi menghadirkan diri!');
-
- return response()->json(['message' => 'RSVP form submitted successfully']);
- }
-
- public function saveSpeech(Request $request) {
- GuestBook::create([
- 'name' => $request->name,
- 'speech' => $request->speech
- ]);
-
- session()->flash('success', 'Terima kasih atas ucapan anda!');
-
- return response()->json(['message' => 'Speech form submitted successfully']);
- }
-
- public function rsvpmain() {
- return view('rsvp-digital-card');
- }
- }
|