Move charge to under service

This commit is contained in:
2024-07-25 14:08:26 +10:00
parent ddd44b643f
commit 743374cb17
17 changed files with 470 additions and 499 deletions

View File

@@ -0,0 +1,41 @@
<?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);
}
}