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\LoanOrder\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Modules\LoanOrder\Models\LoanOrder;
use Illuminate\Auth\Access\HandlesAuthorization;
class LoanOrderPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:LoanOrder');
}
public function view(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('View:LoanOrder');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:LoanOrder');
}
public function update(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Update:LoanOrder');
}
public function delete(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Delete:LoanOrder');
}
public function restore(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Restore:LoanOrder');
}
public function forceDelete(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('ForceDelete:LoanOrder');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:LoanOrder');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:LoanOrder');
}
public function replicate(AuthUser $authUser, LoanOrder $loanOrder): bool
{
return $authUser->can('Replicate:LoanOrder');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:LoanOrder');
}
}

View File

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

View File

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