@@ 94-107 (lines=14) @@ | ||
91 | } |
|
92 | } |
|
93 | ||
94 | private function createOrGetCategory($name) |
|
95 | { |
|
96 | $existingCategory = Category::whereName($name)->first(); |
|
97 | ||
98 | if ($existingCategory) { |
|
99 | return $existingCategory; |
|
100 | } |
|
101 | ||
102 | $newCategory = Category::create([ |
|
103 | 'name' => $name, |
|
104 | ]); |
|
105 | ||
106 | return $newCategory; |
|
107 | } |
|
108 | ||
109 | private function createOrGetSubCategory(Category $parentCategory, $name) |
|
110 | { |
|
@@ 109-122 (lines=14) @@ | ||
106 | return $newCategory; |
|
107 | } |
|
108 | ||
109 | private function createOrGetSubCategory(Category $parentCategory, $name) |
|
110 | { |
|
111 | $existingCategory = Category::whereName($name)->first(); |
|
112 | ||
113 | if ($existingCategory) { |
|
114 | return $existingCategory; |
|
115 | } |
|
116 | ||
117 | $newCategory = $parentCategory->subCategories()->create([ |
|
118 | 'name' => $name, |
|
119 | ]); |
|
120 | ||
121 | return $newCategory; |
|
122 | } |
|
123 | ||
124 | public function deleteTransactions($transactionId) |
|
125 | { |