@@ 127-140 (lines=14) @@ | ||
124 | } |
|
125 | } |
|
126 | ||
127 | private function createOrGetCategory($name) |
|
128 | { |
|
129 | $existingCategory = Category::whereName($name)->first(); |
|
130 | ||
131 | if ($existingCategory) { |
|
132 | return $existingCategory; |
|
133 | } |
|
134 | ||
135 | $newCategory = Category::create([ |
|
136 | 'name' => $name, |
|
137 | ]); |
|
138 | ||
139 | return $newCategory; |
|
140 | } |
|
141 | ||
142 | private function createOrGetSubCategory(Category $parentCategory, $name) |
|
143 | { |
|
@@ 142-155 (lines=14) @@ | ||
139 | return $newCategory; |
|
140 | } |
|
141 | ||
142 | private function createOrGetSubCategory(Category $parentCategory, $name) |
|
143 | { |
|
144 | $existingCategory = Category::whereName($name)->first(); |
|
145 | ||
146 | if ($existingCategory) { |
|
147 | return $existingCategory; |
|
148 | } |
|
149 | ||
150 | $newCategory = $parentCategory->subCategories()->create([ |
|
151 | 'name' => $name, |
|
152 | ]); |
|
153 | ||
154 | return $newCategory; |
|
155 | } |
|
156 | ||
157 | public function deleteTransactions($transactionId) |
|
158 | { |