fix: super_admin permissions not loading on fresh seed

This commit is contained in:
SajjadMahmoody 2026-04-17 20:53:18 +03:30
parent dd63563599
commit 63359a2c15
3 changed files with 72 additions and 0 deletions

View File

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

View File

@ -20,6 +20,7 @@ public function run(): void
SurgeryCenterSeeder::class,
MedicationSeeder::class,
OsurgInitialSeeder::class,
RolePermissionSeeder::class,
]);
}
}

View File

@ -28,6 +28,7 @@ public function run(): void
'surgery_appointment',
'osurg_initial',
'osurg_audit',
'lab_test',
];
$actions = ['view_any', 'view', 'create', 'update', 'delete', 'delete_any', 'restore', 'restore_any', 'replicate', 'reorder', 'force_delete', 'force_delete_any'];