ailixir-api / app /Helpers /OtpHelper.php
AILIXIR Bot
Auto-sync: 201d269f287526269b8ffded5f450ff36b46c740
907b200
Raw
History Blame Contribute Delete
608 Bytes
<?php
namespace App\Helpers;
use App\Models\User;
use App\Services\OtpService;
class OtpHelper
{
/**
* Send OTP by type for a user email
*
* @param string $email
* @param string $type ('email_verification' or 'password_reset')
* @param OtpService $otpService
* @return array
*/
public static function sendOtpByType(string $email, string $type, OtpService $otpService): array
{
$user = User::where('email', $email)->firstOrFail();
$otpService->resendOtp($user, $type);
return [
'email' => $user->email
];
}
}