add policies

This commit is contained in:
2025-11-03 09:15:36 +05:00
parent e9e9f7dbd5
commit 711b5373da
14 changed files with 911 additions and 3 deletions

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Modules\Loan\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\Loan\Models\Loan;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Loan');
}
public function view(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('View:Loan');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Loan');
}
public function update(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Update:Loan');
}
public function delete(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Delete:Loan');
}
public function restore(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Restore:Loan');
}
public function forceDelete(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('ForceDelete:Loan');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Loan');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Loan');
}
public function replicate(AuthUser $authUser, Loan $loan): bool
{
return $authUser->can('Replicate:Loan');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Loan');
}
}