Files
tbbank-new/app/Modules/UserAdjustments/Traits/RoleCheckers.php
Mekan1206 6a700fbd4b Enhance user role checks and update card order tabs visibility
- Updated the isSystemUser method to include currency maintainers in role checks.
- Modified getTabs method in ListCardOrders to return an empty array for non-system users.
- Added a dehydrate state function for Turkmen phone numbers in UserForm schema.
2025-12-21 03:38:52 +05:00

63 lines
1.2 KiB
PHP

<?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', 'operator_card', 'operator_loan']);
}
/**
* 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();
}
}