feat: tambah seeder roles & super_admin, widget dashboard stats

This commit is contained in:
2026-04-03 04:27:07 +07:00
parent aef6978b2a
commit 8675c14f15
12 changed files with 672 additions and 13 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Activity;
use Illuminate\Auth\Access\HandlesAuthorization;
class ActivityPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Activity');
}
public function view(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('View:Activity');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Activity');
}
public function update(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('Update:Activity');
}
public function delete(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('Delete:Activity');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:Activity');
}
public function restore(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('Restore:Activity');
}
public function forceDelete(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('ForceDelete:Activity');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Activity');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Activity');
}
public function replicate(AuthUser $authUser, Activity $activity): bool
{
return $authUser->can('Replicate:Activity');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Activity');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Approval;
use Illuminate\Auth\Access\HandlesAuthorization;
class ApprovalPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Approval');
}
public function view(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('View:Approval');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Approval');
}
public function update(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('Update:Approval');
}
public function delete(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('Delete:Approval');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:Approval');
}
public function restore(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('Restore:Approval');
}
public function forceDelete(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('ForceDelete:Approval');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Approval');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Approval');
}
public function replicate(AuthUser $authUser, Approval $approval): bool
{
return $authUser->can('Replicate:Approval');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Approval');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Audit;
use Illuminate\Auth\Access\HandlesAuthorization;
class AuditPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Audit');
}
public function view(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('View:Audit');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Audit');
}
public function update(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('Update:Audit');
}
public function delete(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('Delete:Audit');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:Audit');
}
public function restore(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('Restore:Audit');
}
public function forceDelete(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('ForceDelete:Audit');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Audit');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Audit');
}
public function replicate(AuthUser $authUser, Audit $audit): bool
{
return $authUser->can('Replicate:Audit');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Audit');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\CashCategory;
use Illuminate\Auth\Access\HandlesAuthorization;
class CashCategoryPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CashCategory');
}
public function view(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('View:CashCategory');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CashCategory');
}
public function update(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('Update:CashCategory');
}
public function delete(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('Delete:CashCategory');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:CashCategory');
}
public function restore(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('Restore:CashCategory');
}
public function forceDelete(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('ForceDelete:CashCategory');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CashCategory');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CashCategory');
}
public function replicate(AuthUser $authUser, CashCategory $cashCategory): bool
{
return $authUser->can('Replicate:CashCategory');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CashCategory');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\CashRecord;
use Illuminate\Auth\Access\HandlesAuthorization;
class CashRecordPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:CashRecord');
}
public function view(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('View:CashRecord');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:CashRecord');
}
public function update(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('Update:CashRecord');
}
public function delete(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('Delete:CashRecord');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:CashRecord');
}
public function restore(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('Restore:CashRecord');
}
public function forceDelete(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('ForceDelete:CashRecord');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:CashRecord');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:CashRecord');
}
public function replicate(AuthUser $authUser, CashRecord $cashRecord): bool
{
return $authUser->can('Replicate:CashRecord');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:CashRecord');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Division;
use Illuminate\Auth\Access\HandlesAuthorization;
class DivisionPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Division');
}
public function view(AuthUser $authUser, Division $division): bool
{
return $authUser->can('View:Division');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Division');
}
public function update(AuthUser $authUser, Division $division): bool
{
return $authUser->can('Update:Division');
}
public function delete(AuthUser $authUser, Division $division): bool
{
return $authUser->can('Delete:Division');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:Division');
}
public function restore(AuthUser $authUser, Division $division): bool
{
return $authUser->can('Restore:Division');
}
public function forceDelete(AuthUser $authUser, Division $division): bool
{
return $authUser->can('ForceDelete:Division');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Division');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Division');
}
public function replicate(AuthUser $authUser, Division $division): bool
{
return $authUser->can('Replicate:Division');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Division');
}
}
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:User');
}
public function view(AuthUser $authUser): bool
{
return $authUser->can('View:User');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:User');
}
public function update(AuthUser $authUser): bool
{
return $authUser->can('Update:User');
}
public function delete(AuthUser $authUser): bool
{
return $authUser->can('Delete:User');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:User');
}
public function restore(AuthUser $authUser): bool
{
return $authUser->can('Restore:User');
}
public function forceDelete(AuthUser $authUser): bool
{
return $authUser->can('ForceDelete:User');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:User');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:User');
}
public function replicate(AuthUser $authUser): bool
{
return $authUser->can('Replicate:User');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:User');
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Vote;
use Illuminate\Auth\Access\HandlesAuthorization;
class VotePolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Vote');
}
public function view(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('View:Vote');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Vote');
}
public function update(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('Update:Vote');
}
public function delete(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('Delete:Vote');
}
public function deleteAny(AuthUser $authUser): bool
{
return $authUser->can('DeleteAny:Vote');
}
public function restore(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('Restore:Vote');
}
public function forceDelete(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('ForceDelete:Vote');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Vote');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Vote');
}
public function replicate(AuthUser $authUser, Vote $vote): bool
{
return $authUser->can('Replicate:Vote');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Vote');
}
}