@@ -204,6 +204,9 @@ |
||
| 204 | 204 | return $this->returnText(Constants::$operation_succeded); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $text |
|
| 209 | + */ |
|
| 207 | 210 | private function returnText($text) |
| 208 | 211 | { |
| 209 | 212 | // TODO: Really dirty hack to force key => value format for outputs via fractal serializer |
@@ -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 | |
@@ -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); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $billsServices = factory(Category::class)->create(['name' => 'Services', 'parent_id' => $bills->id]); |
| 40 | 40 | |
| 41 | 41 | $data = ['MMEX_Post' => '{ "Payees" : [ { "PayeeName" : "Mc Donalds", "DefCateg" : "'.$food->name.'", "DefSubCateg" : "'.$foodPurchases->name.'" },'. |
| 42 | - '{ "PayeeName" : "Spotify", "DefCateg" : "'.$bills->name.'", "DefSubCateg" : "'.$billsServices->name.'" } ] }',]; |
|
| 42 | + '{ "PayeeName" : "Spotify", "DefCateg" : "'.$bills->name.'", "DefSubCateg" : "'.$billsServices->name.'" } ] }', ]; |
|
| 43 | 43 | |
| 44 | 44 | $url = $this->buildUrl('', ['import_payee' => 'true']); |
| 45 | 45 | |
@@ -8,12 +8,12 @@ discard block |
||
| 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, |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'payee_name' => $faker->name, |
| 22 | 22 | 'category_name' => $faker->words(2, true), |
| 23 | 23 | 'sub_category_name' => $faker->words(2, true), |
| 24 | - 'amount' => $faker->randomFloat(2,-1000,1000), |
|
| 24 | + 'amount' => $faker->randomFloat(2, -1000, 1000), |
|
| 25 | 25 | 'notes' => $faker->text, |
| 26 | 26 | ]; |
| 27 | 27 | }); |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | 'Amount' => (string)floatval($item->amount), |
| 30 | 30 | 'Notes' => $item->notes, |
| 31 | 31 | 'Attachments' => $item->getMedia('attachments') |
| 32 | - ->map(function (Media $mediaItem) { |
|
| 32 | + ->map(function(Media $mediaItem) { |
|
| 33 | 33 | return $mediaItem->file_name; |
| 34 | - })->implode(';'),]; |
|
| 34 | + })->implode(';'), ]; |
|
| 35 | 35 | } |
| 36 | 36 | } |