UserSignupVerifyController.php 939 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Services\MessageVerifyService;
  4. class UserSignupVerifyController
  5. {
  6. private $messageVerifyService;
  7. public function __construct(MessageVerifyService $messageVerifyService)
  8. {
  9. $this->messageVerifyService = $messageVerifyService;
  10. }
  11. public function index()
  12. {
  13. return view('auth.user-signup-verify');
  14. }
  15. public function store()
  16. {
  17. if (request('cert_number') != session('smsCert.number')) {
  18. notify()->error(_e('Action failed'), 'Error', 'bottomRight');
  19. return redirect()->back();
  20. }
  21. session()->forget('smsCert.number');
  22. session()->put('smsCert.code', 200);
  23. return redirect()->route('user-signup.index');
  24. }
  25. public function sendCert()
  26. {
  27. $response = $this->messageVerifyService->send(request('mobile_no'));
  28. return response()->json($response);
  29. }
  30. }