Files
hoshpoint-backend/app/Policies/WalletPolicy.php

30 lines
568 B
PHP

<?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');
}
}