Akaunting/database/factories/Transfer.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2020-01-13 22:05:32 +00:00
<?php
2020-10-14 14:07:59 +00:00
namespace Database\Factories;
use App\Abstracts\Factory;
2020-01-13 22:05:32 +00:00
use App\Models\Banking\Account;
2020-10-14 14:07:59 +00:00
use App\Models\Banking\Transfer as Model;
2020-01-13 22:05:32 +00:00
2020-10-14 14:07:59 +00:00
class Transfer extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
2020-01-13 22:05:32 +00:00
2020-10-14 14:07:59 +00:00
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
2022-12-16 07:26:41 +00:00
$from_account = Account::factory()->enabled()->default_currency()->create();
2020-01-13 22:05:32 +00:00
2022-12-16 07:26:41 +00:00
$to_account = Account::factory()->enabled()->default_currency()->create();
2020-01-13 22:05:32 +00:00
2022-12-16 07:26:41 +00:00
return [
'company_id' => $this->company->id,
'from_account_id' => $from_account->id,
'to_account_id' => $to_account->id,
2020-10-14 14:07:59 +00:00
'amount' => $this->faker->randomFloat(2, 1, 1000),
2022-12-16 07:26:41 +00:00
'transferred_at' => $this->faker->date(),
'description'=> $this->faker->text(20),
'payment_method' => setting('default.payment_method'),
2020-10-14 14:07:59 +00:00
'reference' => $this->faker->text(20),
2021-09-09 21:31:39 +00:00
'created_from' => 'core::factory',
2020-10-14 14:07:59 +00:00
];
}
}