PHP code example of bbs-lab / nova-force-two-factor

1. Go to this page and download the library: Download bbs-lab/nova-force-two-factor 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/ */

    

bbs-lab / nova-force-two-factor example snippets


return [

    // Enforce 2FA enrolment. Set NOVA_FORCE_TWO_FACTOR=false to disable (e.g. locally).
    'enabled' => (bool) env('NOVA_FORCE_TWO_FACTOR', true),

    // Let the package inject the middleware into Nova's stack. Turn off to wire it up yourself.
    'auto_register_middleware' => (bool) env('NOVA_FORCE_TWO_FACTOR_AUTO_MIDDLEWARE', true),

    // Requests matching any of these are let through even when the admin has not enrolled.
    'except' => [
        'routes' => [
            'nova-password-rotation.expired.*',
        ],
        'paths' => [
            //
        ],
    ],

];

use BBSLab\NovaForceTwoFactor\Http\Middleware\EnsureTwoFactorEnabled;

'middleware' => [
    // …
    EnsureTwoFactorEnabled::class,
],
bash
php artisan vendor:publish --tag="nova-force-two-factor-config"
bash
php artisan vendor:publish --tag="nova-force-two-factor-translations"