PHP code example of moeen-basra / laravel-passport-otp-grant
1. Go to this page and download the library: Download moeen-basra/laravel-passport-otp-grant 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/ */
moeen-basra / laravel-passport-otp-grant example snippets
use Illuminate\Foundation\Auth\User as BaseUser;
use MoeenBasra\OneTimePinGrant\Interfaces\OneTimePinGrantUserInterface;
class User extends BaseUser implements OneTimePinGrantUserInterface
{
//...
/**
* {@inheritDoc}
*/
public function findAndValidateForPassportOtpGrant(string $mobile_number, string $code)
{
if (!OneTimePin::validate($mobile_number, $code)) {
return null;
}
return static::firstOrCreate([
'mobile_number' => $mobile_number
]);
}
}
'providers' => [
//...
MoeenBasra\OneTimePinGrant\OneTimePinGrantServiceProvider::class,
]