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

MainController.php 1010B

123456789101112131415161718192021222324252627282930313233343536373839
  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() {
  9. $rsvp = RSVP::all();
  10. $guestbook = GuestBook::all();
  11. return view('digital-card', compact(['rsvp', 'guestbook']));
  12. }
  13. public function saveRsvp(Request $request) {
  14. RSVP::create([
  15. 'name' => $request->name,
  16. 'member' => $request->member
  17. ]);
  18. session()->flash('success', 'Terima kasih kerana sudi menghadirkan diri!');
  19. return response()->json(['message' => 'RSVP form submitted successfully']);
  20. }
  21. public function saveSpeech(Request $request) {
  22. GuestBook::create([
  23. 'name' => $request->name,
  24. 'speech' => $request->speech
  25. ]);
  26. session()->flash('success', 'Terima kasih atas ucapan anda!');
  27. return response()->json(['message' => 'Speech form submitted successfully']);
  28. }
  29. }