getBasePermissions(); } public function getTitle(): string { return __('permissions.' . $this->name); } public function formatValue(string $permission): string { return $this->value . '.' . $permission; } public static function toArrayList(): array { $permissions = []; foreach (self::cases() as $permissionEnum) { foreach ($permissionEnum->getPermissions() as $permissionName => $permissionTitle) { $name = $permissionEnum->formatValue($permissionName); $title = $permissionEnum->getTitle() . ' - ' . $permissionTitle; $permissions[$name] = $title; } } return $permissions; } public static function toArrayListCodes(): array { return \array_keys(self::toArrayList()); } private function getBasePermissions(): array { return [ 'view' => __('permissions.Allowed to watch'), 'create' => __('permissions.Allowed to create'), 'update' => __('permissions.Allowed to edit'), 'delete' => __('permissions.Allowed to delete'), ]; } }