added expense state
This commit is contained in:
parent
d2b78e27c7
commit
bfa445c322
@ -5,10 +5,10 @@ use App\Models\Banking\Transaction;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
||||
$factory->define(Transaction::class, function (Faker $faker) {
|
||||
$user = User::first();
|
||||
$company = $user->companies()->first();
|
||||
$user = User::first();
|
||||
$company = $user->companies()->first();
|
||||
|
||||
$factory->define(Transaction::class, function (Faker $faker) use ($company) {
|
||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
||||
|
||||
$attachment = UploadedFile::fake()->create('image.jpg');
|
||||
@ -22,9 +22,18 @@ $factory->define(Transaction::class, function (Faker $faker) {
|
||||
'currency_code' => setting('default.currency'),
|
||||
'currency_rate' => '1',
|
||||
'description' => $faker->text(5),
|
||||
'category_id' => $company->categories()->type('income')->first()->id,
|
||||
'category_id' => $company->categories()->type('income')->pluck('id')->first(),
|
||||
'reference' => $faker->text(5),
|
||||
'payment_method' => setting('default.payment_method'),
|
||||
//'attachment' => $attachment,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Transaction::class, 'income', []);
|
||||
|
||||
$factory->state(Transaction::class, 'expense', function (Faker $faker) use ($company) {
|
||||
return [
|
||||
'type' => 'expense',
|
||||
'category_id' => $company->categories()->type('expense')->pluck('id')->first(),
|
||||
];
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user