PHP code example of coucounco / laravel-otc

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

    

coucounco / laravel-otc example snippets


return [
    'notifier_class' => \Illuminate\Support\Facades\Notification::class,
    'notification_class' => \coucounco\LaravelOtc\Notifications\OneTimeCodeNotification::class,

    'authenticatables' => [
        'user' => [
            'model' => \App\Models\User::class,
            'identifier' => 'email',
        ]
    ]
];

'notifier_class' => \Illuminate\Support\Facades\Notification::class,

public function __construct(OtcToken $token) {
    $this->token = $token;
}

$token->code

'user' => [
    'model' => \App\Models\User::class,
    'identifier' => 'email',
]

if(!Otc::check()) {
    return Otc::unauthorizedResponse($user);
}
bash
php artisan otc:install
 php
Otc::check()

POST /vendor/coucounco/laravel-otc/auth/request-code

POST /vendor/coucounco/laravel-otc/auth/code

    'paths' => [
        // ...
        'vendor/coucounco/laravel-otc/*',
    ],