wip
This commit is contained in:
@@ -29,5 +29,5 @@ return [
|
||||
'change_phone_label' => 'Telefon belgini üýtgetmek',
|
||||
'go_back' => 'Yza',
|
||||
'successfully_changed_phone' => 'Telefon belgiňiz üýtgedildi',
|
||||
'resend' => 'Täze tassyklaýyş belgi ugratmak'
|
||||
'resend' => 'Täze tassyklaýyş belgi ugratmak',
|
||||
];
|
||||
|
||||
62
app/Modules/UserAdjustments/Traits/RoleCheckers.php
Normal file
62
app/Modules/UserAdjustments/Traits/RoleCheckers.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\UserAdjustments\Traits;
|
||||
|
||||
trait RoleCheckers
|
||||
{
|
||||
/**
|
||||
* Check if user is me.
|
||||
*/
|
||||
public function isMe(): bool
|
||||
{
|
||||
return $this->email === 'nurmuhammet@mail.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is super admin.
|
||||
*/
|
||||
public function isSuperAdmin(): bool
|
||||
{
|
||||
if ($this->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->hasRole('superadmin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is admin.
|
||||
*/
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
if ($this->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->hasRole(['king', 'superadmin', 'admin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is operator.
|
||||
*/
|
||||
public function isOperator(): bool
|
||||
{
|
||||
return $this->hasRole('operator');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is a currency maintainer.
|
||||
*/
|
||||
public function isCurrencyMaintainer(): bool
|
||||
{
|
||||
return $this->hasRole('currency_maintainer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Is System User
|
||||
*/
|
||||
public function isSystemUser(): bool
|
||||
{
|
||||
return $this->isAdmin() || $this->isOperator() || $this->isCurrencyMaintainer();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Modules\UserAdjustments\Traits;
|
||||
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Filament\Panel;
|
||||
|
||||
/**
|
||||
* @property string $username [unique]
|
||||
@@ -19,6 +18,7 @@ use Filament\Panel;
|
||||
trait UserAdjustments
|
||||
{
|
||||
use HasRoles;
|
||||
use RoleCheckers;
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
|
||||
Reference in New Issue
Block a user