feat(wallets): implement wallet and transaction management with associated models, policies, and resources

This commit is contained in:
2026-06-07 00:18:32 +03:30
parent c2319a55cb
commit d1d42b38d1
23 changed files with 790 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Wallet;
class WalletPolicy
{
public function viewAny(User $user): bool
{
return $this->canManage($user);
}
public function view(User $user, Wallet $wallet): bool
{
return $this->canManage($user);
}
public function update(User $user, Wallet $wallet): bool
{
return $this->canManage($user);
}
private function canManage(User $user): bool
{
return $user->hasRole('admin') || $user->hasPermission('wallets.manage');
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\WalletTransaction;
class WalletTransactionPolicy
{
public function viewAny(User $user): bool
{
return $this->canManage($user);
}
public function view(User $user, WalletTransaction $transaction): bool
{
return $this->canManage($user);
}
private function canManage(User $user): bool
{
return $user->hasRole('admin') || $user->hasPermission('wallets.manage');
}
}