PHP code example of dcvn / otp-laravel

1. Go to this page and download the library: Download dcvn/otp-laravel 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/ */

    

dcvn / otp-laravel example snippets



$otp = OneTimePassword::configured();
if ($otp->verifyCode($user->otp_secret), $request->verification) { /* ... */ }


use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Gate;

// in boot():
Gate::define('otp.setup', function (Authenticatable $user, Authenticatable $model) {
    return $user->id == $model->id;
});