osb/app/Models/Policies/ChargePolicy.php

41 lines
764 B
PHP
Raw Normal View History

2024-07-25 04:08:26 +00:00
<?php
namespace App\Models\Policies;
use App\Models\{Account,Charge,User};
class ChargePolicy
{
/**
* Determine whether the user can update the model.
*/
public function create(User $user,Account $account): bool
{
return $user->isReseller()
&& $user
->accounts_all
->contains($account->id);
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user,Charge $charge): bool
{
return $user->isReseller()
&& $user
->accounts_all
->contains($charge->account_id);
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user,Charge $charge): bool
{
return $user->isReseller()
&& $user
->accounts_all
->contains($charge->account_id);
}
}