Spaces:
Running
Running
Download app/Helpers/OtpHelper.php from Ailixir-AI-Team/ailixir-api: direct link, hf CLI and curl.
- Browser
- Download file 608 Bytes
-
https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/main/app/Helpers/OtpHelper.php
- Command line
-
hf download hf://spaces/Ailixir-AI-Team/ailixir-api/app/Helpers/OtpHelper.php
-
curl -L -o OtpHelper.php https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/main/app/Helpers/OtpHelper.php
608 Bytes
| 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 | |
| ]; | |
| } | |
| } | |