<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tech-djoin / laravel-admin-ext-google-authenticator example snippets
namespace App\Models;
use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Notifications\Notifiable;
use TechDjoin\LaravelAdminGoogleAuthenticator\Traits\Google2FAAuthenticatableTrait;
class AdminUser extends Administrator
{
use Notifiable;
use Google2FAAuthenticatableTrait;
protected $fillable = ['username', 'password', 'name', 'avatar', 'google2fa_secret'];
public function setGoogle2faSecretAttribute($value)
{
$this->attributes['google2fa_secret'] = !is_null($value) ? encrypt($value) : null;
}
public function getGoogle2faSecretAttribute($value)
{
return isset($value) ? decrypt($value) : null;
}
}