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. $host = $request->getHost();
  12. if ($host == 'aliffayuna.com') {
  13. return view('digital-card', compact(['rsvp', 'guestbook']));
  14. }
  15. if ($host == '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. }