In some occasions you may need to add OTP verification for your logged-in dashboard. Various ways exist for OTP verification (like Laravel https://jetstream.laravel.com//https://laravel.com/docs/9.x/fortify) which will require your end user to have a separate mobile app for this.
The package provides an easy way to add SMS OTP verification to your app.
The Laravel OTP package by default listens to the Login event to send a notification to the user.
generateOtpAndSend($request->user()); return response()->noContent(); } public function check(Request $request) { $request->validate([ 'otp' => ['required', 'numeric'], ]); $otpValid = app(OtpService::class)->check($request->user(), $request->get('otp')); throw_unless($otpValid, ValidationException::withMessages([ 'otp' => 'Invalid otp!', ])); return back(); } public function resend(Request $request) { app(OtpService::class)->generateOtpAndSend($request->user()); return back(); }}