Wedding Invitation
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

MainController.php 1.4KB

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