@@ -8,12 +8,12 @@ |
||
| 8 | 8 | * |
| 9 | 9 | * @version 1.0 |
| 10 | 10 | */ |
| 11 | -$factory->define(App\Models\Transaction::class, function (Faker\Generator $faker) { |
|
| 11 | +$factory->define(App\Models\Transaction::class, function(Faker\Generator $faker) { |
|
| 12 | 12 | return [ |
| 13 | - 'status_id' => function () { |
|
| 13 | + 'status_id' => function() { |
|
| 14 | 14 | return factory(App\Models\TransactionStatus::class)->create()->id; |
| 15 | 15 | }, |
| 16 | - 'type_id' => function () { |
|
| 16 | + 'type_id' => function() { |
|
| 17 | 17 | return factory(App\Models\TransactionType::class)->create()->id; |
| 18 | 18 | }, |
| 19 | 19 | 'account_name' => $faker->word, |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * |
| 9 | 9 | * @version 1.0 |
| 10 | 10 | */ |
| 11 | -$factory->define(App\Models\TransactionType::class, function (Faker\Generator $faker) { |
|
| 11 | +$factory->define(App\Models\TransactionType::class, function(Faker\Generator $faker) { |
|
| 12 | 12 | // $TypeArrayDesc = array ("Withdrawal", "Deposit", "Transfer"); |
| 13 | 13 | return [ |
| 14 | 14 | 'name' => $faker->word, |
@@ -36,6 +36,9 @@ |
||
| 36 | 36 | return $this->belongsTo(TransactionType::class); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $filePath |
|
| 41 | + */ |
|
| 39 | 42 | public function addAttachment($filePath, $preventOriginal = false) |
| 40 | 43 | { |
| 41 | 44 | $fileName = basename($filePath); |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $transaction = Transaction::findOrFail($transactionId); |
| 88 | 88 | |
| 89 | 89 | // get attachment of transaction |
| 90 | - $media = $transaction->getMedia('attachments')->first(function ($item) use ($fileName) { |
|
| 90 | + $media = $transaction->getMedia('attachments')->first(function($item) use ($fileName) { |
|
| 91 | 91 | return $item->file_name == $fileName; |
| 92 | 92 | }); |
| 93 | 93 | |
@@ -206,6 +206,9 @@ |
||
| 206 | 206 | return $this->returnText(Constants::$operation_succeded); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | + /** |
|
| 210 | + * @param string $text |
|
| 211 | + */ |
|
| 209 | 212 | private function returnText($text) |
| 210 | 213 | { |
| 211 | 214 | return response($text, 200) |
@@ -27,10 +27,10 @@ |
||
| 27 | 27 | 'Payee' => $item->payee_name, |
| 28 | 28 | 'Category' => $item->category_name, |
| 29 | 29 | 'SubCategory' => $item->sub_category_name, |
| 30 | - 'Amount' => (string) floatval($item->amount), |
|
| 30 | + 'Amount' => (string)floatval($item->amount), |
|
| 31 | 31 | 'Notes' => $item->notes, |
| 32 | 32 | 'Attachments' => $item->getMedia('attachments') |
| 33 | - ->map(function (Media $mediaItem) { |
|
| 33 | + ->map(function(Media $mediaItem) { |
|
| 34 | 34 | return $mediaItem->file_name; |
| 35 | 35 | })->implode(';'), ]; |
| 36 | 36 | } |