generated from IBEC-BOX/admin-kit-package-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from IBEC-BOX/feat/policy
Feat/policy
- Loading branch information
Showing
2 changed files
with
127 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?php | ||
|
||
namespace AdminKit\Localizations\Policies; | ||
|
||
use AdminKit\Localizations\Models\Localization; | ||
use App\Models\AdminKitUser; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class LocalizationPolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
/** | ||
* Determine whether the adminKitUser can view any models. | ||
*/ | ||
public function viewAny(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('view_any_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can view the model. | ||
*/ | ||
public function view(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('view_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can create models. | ||
*/ | ||
public function create(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('create_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can update the model. | ||
*/ | ||
public function update(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('update_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can delete the model. | ||
*/ | ||
public function delete(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('delete_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can bulk delete. | ||
*/ | ||
public function deleteAny(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('delete_any_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can permanently delete. | ||
*/ | ||
public function forceDelete(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('force_delete_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can permanently bulk delete. | ||
*/ | ||
public function forceDeleteAny(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('force_delete_any_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can restore. | ||
*/ | ||
public function restore(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('restore_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can bulk restore. | ||
*/ | ||
public function restoreAny(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('restore_any_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can replicate. | ||
*/ | ||
public function replicate(AdminKitUser $adminKitUser, Localization $localization): bool | ||
{ | ||
return $adminKitUser->can('replicate_localization'); | ||
} | ||
|
||
/** | ||
* Determine whether the adminKitUser can reorder. | ||
*/ | ||
public function reorder(AdminKitUser $adminKitUser): bool | ||
{ | ||
return $adminKitUser->can('reorder_localization'); | ||
} | ||
} |