fixed #1835
This commit is contained in:
parent
74ee6fd0d4
commit
53e12abe38
@ -27,6 +27,8 @@ class Transaction extends Factory
|
|||||||
$types = array_merge($this->getIncomeTypes(), $this->getExpenseTypes());
|
$types = array_merge($this->getIncomeTypes(), $this->getExpenseTypes());
|
||||||
$type = $this->faker->randomElement($types);
|
$type = $this->faker->randomElement($types);
|
||||||
|
|
||||||
|
$category_type = in_array($type, $this->getIncomeTypes()) ? 'income' : 'expense';
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
@ -36,7 +38,7 @@ class Transaction extends Factory
|
|||||||
'currency_code' => setting('default.currency'),
|
'currency_code' => setting('default.currency'),
|
||||||
'currency_rate' => '1.0',
|
'currency_rate' => '1.0',
|
||||||
'description' => $this->faker->text(5),
|
'description' => $this->faker->text(5),
|
||||||
'category_id' => $this->company->categories()->type($type)->get()->random(1)->pluck('id')->first(),
|
'category_id' => $this->company->categories()->$category_type()->get()->random(1)->pluck('id')->first(),
|
||||||
'reference' => $this->faker->text(5),
|
'reference' => $this->faker->text(5),
|
||||||
'payment_method' => setting('default.payment_method'),
|
'payment_method' => setting('default.payment_method'),
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user