Move charge to under service
This commit is contained in:
41
app/Models/Policies/ChargePolicy.php
Normal file
41
app/Models/Policies/ChargePolicy.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user