feat: menric
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Concerns;
|
||||
|
||||
use App\Models\Admin;
|
||||
use App\Models\User;
|
||||
use App\Models\WalletMnemonic;
|
||||
|
||||
trait RevealsMnemonics
|
||||
{
|
||||
protected function canRevealMnemonics(): bool
|
||||
{
|
||||
if ($this->isAgentPortal()) {
|
||||
$agent = $this->agent();
|
||||
|
||||
return $agent instanceof User && $agent->canRevealMnemonics();
|
||||
}
|
||||
|
||||
$admin = auth('admin')->user();
|
||||
|
||||
return $admin instanceof Admin && $admin->canRevealMnemonics();
|
||||
}
|
||||
|
||||
protected function googleBoundForReveal(): bool
|
||||
{
|
||||
if ($this->isAgentPortal()) {
|
||||
$agent = $this->agent();
|
||||
|
||||
return $agent instanceof User && $agent->hasGoogleBound();
|
||||
}
|
||||
|
||||
$admin = auth('admin')->user();
|
||||
|
||||
return $admin instanceof Admin && $admin->hasGoogleBound();
|
||||
}
|
||||
|
||||
protected function mnemonicRevealUrl(int|string|WalletMnemonic $mnemonic): string
|
||||
{
|
||||
return route($this->portal().'.mnemonics.reveal', $mnemonic);
|
||||
}
|
||||
|
||||
protected function google2faUrl(): string
|
||||
{
|
||||
return route($this->portal().'.security.google2fa');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user