Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update category code for #4015
James Cole5d872bead70e
diff --git a/app/Api/V1/Controllers/CategoryController.php b/app/Api/V1/Controllers/CategoryController.phpindex 5225fca28b..1fa628cbcf 100644--- a/app/Api/V1/Controllers/CategoryController.php+++ b/app/Api/V1/Controllers/CategoryController.php@@ -47,9 +47,7 @@ use League\Fractal\Resource\Item;class CategoryController extends Controller{use TransactionFilter;-- /** @var CategoryRepositoryInterface The category repository */- private $repository;+ private CategoryRepositoryInterface $repository;/**diff --git a/app/Api/V1/Requests/CategoryStoreRequest.php b/app/Api/V1/Requests/CategoryStoreRequest.phpindex 3edc6c80c0..405739c833 100644--- a/app/Api/V1/Requests/CategoryStoreRequest.php+++ b/app/Api/V1/Requests/CategoryStoreRequest.php@@ -45,7 +45,8 @@ class CategoryStoreRequest extends FormRequestpublic function getAll(): array{return [- 'name' => $this->string('name'),+ 'name' => $this->string('name'),+ 'notes' => $this->nlString('notes'),];}@@ -57,7 +58,7 @@ class CategoryStoreRequest extends FormRequestpublic function rules(): array{return [- 'name' => 'required|between:1,100|uniqueObjectForUser:categories,name'+ 'name' => 'required|between:1,100|uniqueObjectForUser:categories,name',];}}diff --git a/app/Api/V1/Requests/CategoryUpdateRequest.php b/app/Api/V1/Requests/CategoryUpdateRequest.phpindex 45b7b3ca13..29b6e003fe 100644--- a/app/Api/V1/Requests/CategoryUpdateRequest.php+++ b/app/Api/V1/Requests/CategoryUpdateRequest.php@@ -43,8 +43,15 @@ class CategoryUpdateRequest extends FormRequest*/public function getAll(): array{+ $notes = null;+ $all = $this->all();+ if (array_key_exists('notes', $all)) {+ $notes = $this->nlString('notes');+ }+return [- 'name' => $this->string('name'),+ 'name' => $this->string('name'),+ 'notes' => $notes,];}