1. Go to this page and download the library: Download ars/laravel-otp-code library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Ars\Otp\Rules\OtpCode;
$request->validate([
'email' => '[email protected]',
'otp_code' => ['
use Ars\Otp\Facades\OtpCode;
//If has salt send parameter after identifier
public function sendOtp($email, $salt = null)
{
if (OtpCode::has($email, $salt)) {
return Responder::setErrorCode(201)->setMessage(trans('otp_code::otp-code.already_send'))->respond();
}
$otp = OtpCode::create($email, $salt);
Notification::send($email, new OtpNotification($otp->code));
}