Compare commits
2 Commits
8e548126b2
...
b1630ea623
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1630ea623 | ||
|
|
6a700fbd4b |
@@ -21,7 +21,12 @@ class ListCardOrders extends ListRecords
|
||||
|
||||
public function getTabs(): array
|
||||
{
|
||||
if (! user()->isSystemUser()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach (array_keys(OrderStatusRepository::statusClasses()) as $status) {
|
||||
if ($status === '') {
|
||||
$data[null] = Tab::make(__('All'));
|
||||
|
||||
@@ -32,6 +32,7 @@ class UserForm
|
||||
->unique(ignoreRecord: true)
|
||||
->mask('99 99 99 99')
|
||||
->prefix('+993')
|
||||
->dehydrateStateUsing(fn($state) => unMaskTurkmenNumber($state))
|
||||
->rules([
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
|
||||
69
app/Modules/CurrencyRate/Policies/CurrencyRatePolicy.php
Normal file
69
app/Modules/CurrencyRate/Policies/CurrencyRatePolicy.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\CurrencyRate\Policies;
|
||||
|
||||
use App\Modules\CurrencyRate\Models\CurrencyRate;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
|
||||
class CurrencyRatePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('View:CurrencyRate');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:CurrencyRate');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Update:CurrencyRate');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Delete:CurrencyRate');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Restore:CurrencyRate');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:CurrencyRate');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:CurrencyRate');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, CurrencyRate $currencyRate): bool
|
||||
{
|
||||
return $authUser->can('Replicate:CurrencyRate');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:CurrencyRate');
|
||||
}
|
||||
}
|
||||
50
app/Modules/OnlinePayment/Policies/OnlinePaymentPolicy.php
Normal file
50
app/Modules/OnlinePayment/Policies/OnlinePaymentPolicy.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\OnlinePayment\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\OnlinePayment\Models\OnlinePayment;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class OnlinePaymentPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('ViewAny:OnlinePayment');
|
||||
}
|
||||
|
||||
public function view(User $user, OnlinePayment $onlinePayment): bool
|
||||
{
|
||||
return $user->can('View:OnlinePayment');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('Create:OnlinePayment');
|
||||
}
|
||||
|
||||
public function update(User $user, OnlinePayment $onlinePayment): bool
|
||||
{
|
||||
return $user->can('Update:OnlinePayment');
|
||||
}
|
||||
|
||||
public function delete(User $user, OnlinePayment $onlinePayment): bool
|
||||
{
|
||||
return $user->can('Delete:OnlinePayment');
|
||||
}
|
||||
|
||||
public function restore(User $user, OnlinePayment $onlinePayment): bool
|
||||
{
|
||||
return $user->can('Restore:OnlinePayment');
|
||||
}
|
||||
|
||||
public function forceDelete(User $user, OnlinePayment $onlinePayment): bool
|
||||
{
|
||||
return $user->can('ForceDelete:OnlinePayment');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ trait RoleCheckers
|
||||
*/
|
||||
public function isSystemUser(): bool
|
||||
{
|
||||
return $this->isAdmin() || $this->isOperator();
|
||||
return $this->isAdmin() || $this->isOperator() || $this->isCurrencyMaintainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class VisaMasterPaymentOrderItemPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('ViewAny:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function view(User $user, VisaMasterPaymentOrderItem $visaMasterPaymentOrderItem): bool
|
||||
{
|
||||
return $user->can('View:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('Create:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function update(User $user, VisaMasterPaymentOrderItem $visaMasterPaymentOrderItem): bool
|
||||
{
|
||||
return $user->can('Update:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function delete(User $user, VisaMasterPaymentOrderItem $visaMasterPaymentOrderItem): bool
|
||||
{
|
||||
return $user->can('Delete:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function restore(User $user, VisaMasterPaymentOrderItem $visaMasterPaymentOrderItem): bool
|
||||
{
|
||||
return $user->can('Restore:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
|
||||
public function forceDelete(User $user, VisaMasterPaymentOrderItem $visaMasterPaymentOrderItem): bool
|
||||
{
|
||||
return $user->can('ForceDelete:VisaMasterPaymentOrderItem');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class VisaMasterPaymentOrderPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('ViewAny:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function view(User $user, VisaMasterPaymentOrder $visaMasterPaymentOrder): bool
|
||||
{
|
||||
return $user->can('View:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('Create:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function update(User $user, VisaMasterPaymentOrder $visaMasterPaymentOrder): bool
|
||||
{
|
||||
return $user->can('Update:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function delete(User $user, VisaMasterPaymentOrder $visaMasterPaymentOrder): bool
|
||||
{
|
||||
return $user->can('Delete:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function restore(User $user, VisaMasterPaymentOrder $visaMasterPaymentOrder): bool
|
||||
{
|
||||
return $user->can('Restore:VisaMasterPaymentOrder');
|
||||
}
|
||||
|
||||
public function forceDelete(User $user, VisaMasterPaymentOrder $visaMasterPaymentOrder): bool
|
||||
{
|
||||
return $user->can('ForceDelete:VisaMasterPaymentOrder');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class VisaMasterSettingsPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('ViewAny:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function view(User $user, VisaMasterSettings $visaMasterSettings): bool
|
||||
{
|
||||
return $user->can('View:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('Create:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function update(User $user, VisaMasterSettings $visaMasterSettings): bool
|
||||
{
|
||||
return $user->can('Update:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function delete(User $user, VisaMasterSettings $visaMasterSettings): bool
|
||||
{
|
||||
return $user->can('Delete:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function restore(User $user, VisaMasterSettings $visaMasterSettings): bool
|
||||
{
|
||||
return $user->can('Restore:VisaMasterSettings');
|
||||
}
|
||||
|
||||
public function forceDelete(User $user, VisaMasterSettings $visaMasterSettings): bool
|
||||
{
|
||||
return $user->can('ForceDelete:VisaMasterSettings');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,18 @@ use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder::class => \App\Modules\VisaMasterPaymentOrder\Policies\VisaMasterPaymentOrderPolicy::class,
|
||||
\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem::class => \App\Modules\VisaMasterPaymentOrder\Policies\VisaMasterPaymentOrderItemPolicy::class,
|
||||
\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings::class => \App\Modules\VisaMasterPaymentOrder\Policies\VisaMasterSettingsPolicy::class,
|
||||
\App\Modules\OnlinePayment\Models\OnlinePayment::class => \App\Modules\OnlinePayment\Policies\OnlinePaymentPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user