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

MainController.php 1.3KB

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. $currentUrl = $request->fullUrl();
  12. if ($currentUrl == 'https://aliffayuna.com/') {
  13. return view('digital-card', compact(['rsvp', 'guestbook']));
  14. }
  15. if ($currentUrl == 'https://rsvp.aliffayuna.com/') {
  16. return view('rsvp-digital-card');
  17. }
  18. }
  19. public function saveRsvp(Request $request) {
  20. RSVP::create([
  21. 'name' => $request->name,
  22. 'member' => $request->member,
  23. 'phone' => $request->phone
  24. ]);
  25. session()->flash('success', 'Terima kasih kerana sudi menghadirkan diri!');
  26. return response()->json(['message' => 'RSVP form submitted successfully']);
  27. }
  28. public function saveSpeech(Request $request) {
  29. GuestBook::create([
  30. 'name' => $request->name,
  31. 'speech' => $request->speech
  32. ]);
  33. session()->flash('success', 'Terima kasih atas ucapan anda!');
  34. return response()->json(['message' => 'Speech form submitted successfully']);
  35. }
  36. public function rsvpmain() {
  37. return view('rsvp-digital-card');
  38. }
  39. }