Wedding Invitation
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MainController.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Models\RSVP;
  5. use App\Models\GuestBook;
  6. class MainController extends Controller
  7. {
  8. public function main(Request $request) {
  9. $rsvp = RSVP::all();
  10. $guestbook = GuestBook::all();
  11. $host = $request->getHost();
  12. if ($host == 'aliffayuna.com') {
  13. return view('digital-card', compact(['rsvp', 'guestbook']));
  14. } else if ($host == 'rsvp.aliffayuna.com') {
  15. return view('rsvp-digital-card');
  16. } else {
  17. return view('rsvp-digital-card');
  18. }
  19. }
  20. public function saveRsvp(Request $request) {
  21. RSVP::create([
  22. 'name' => $request->name,
  23. 'member' => $request->member,
  24. 'phone' => $request->phone
  25. ]);
  26. session()->flash('success', 'Terima kasih kerana sudi menghadirkan diri!');
  27. return response()->json(['message' => 'RSVP form submitted successfully']);
  28. }
  29. public function saveSpeech(Request $request) {
  30. GuestBook::create([
  31. 'name' => $request->name,
  32. 'speech' => $request->speech
  33. ]);
  34. session()->flash('success', 'Terima kasih atas ucapan anda!');
  35. return response()->json(['message' => 'Speech form submitted successfully']);
  36. }
  37. public function rsvpmain() {
  38. return view('rsvp-digital-card');
  39. }
  40. }