From 371e142bae986a97f529d7e890f4066b7deb8d3e Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 15 Mar 2023 15:57:45 -0700 Subject: [PATCH] removes unnecessary function --- app/Helpers/Helper.php | 25 ++++--------------- .../Transformers/CategoriesTransformer.php | 2 +- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 4d862d8627..c77e0f8f27 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -528,7 +528,7 @@ class Helper * @since [v2.5] * @return array */ - public static function categoryTypeList() + public static function categoryTypeList($selection=null) { $category_types = [ '' => '', @@ -539,27 +539,12 @@ class Helper 'license' => trans('general.license'), ]; + if($selection != null){ + return $category_types[$selection]; + } + else return $category_types; } - public static function categoryType($category_type){ - - switch ($category_type) { - case ('accessory'): - return trans('general.accessory'); - break; - case ('consumable'): - return trans('general.consumable'); - break; - case ('component'): - return trans('general.component'); - break; - case ('asset'): - return trans('general.asset'); - case ('license'): - return trans('general.license'); - } - } - /** * Get the list of custom fields in an array to make a dropdown menu * diff --git a/app/Http/Transformers/CategoriesTransformer.php b/app/Http/Transformers/CategoriesTransformer.php index 84c1aad8ca..35dac986dd 100644 --- a/app/Http/Transformers/CategoriesTransformer.php +++ b/app/Http/Transformers/CategoriesTransformer.php @@ -47,7 +47,7 @@ class CategoriesTransformer 'id' => (int) $category->id, 'name' => e($category->name), 'image' => ($category->image) ? Storage::disk('public')->url('categories/'.e($category->image)) : null, - 'category_type' => Helper::categoryType($category->category_type), + 'category_type' => Helper::categoryTypeList($category->category_type), 'has_eula' => ($category->getEula() ? true : false), 'use_default_eula' => ($category->use_default_eula=='1' ? true : false), 'eula' => ($category->getEula()),