added more scopes
This commit is contained in:
@ -41,7 +41,7 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) {
|
||||
'currency_code' => setting('default.currency'),
|
||||
'currency_rate' => '1',
|
||||
'notes' => $faker->text(5),
|
||||
'category_id' => $company->categories()->type('expense')->get()->random(1)->pluck('id')->first(),
|
||||
'category_id' => $company->categories()->expense()->get()->random(1)->pluck('id')->first(),
|
||||
'contact_id' => $contact->id,
|
||||
'contact_name' => $contact->name,
|
||||
'contact_email' => $contact->email,
|
||||
|
@ -42,7 +42,7 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) {
|
||||
'currency_code' => setting('default.currency'),
|
||||
'currency_rate' => '1',
|
||||
'notes' => $faker->text(5),
|
||||
'category_id' => $company->categories()->type('income')->get()->random(1)->pluck('id')->first(),
|
||||
'category_id' => $company->categories()->income()->get()->random(1)->pluck('id')->first(),
|
||||
'contact_id' => $contact->id,
|
||||
'contact_name' => $contact->name,
|
||||
'contact_email' => $contact->email,
|
||||
|
@ -16,7 +16,7 @@ $factory->define(Item::class, function (Faker $faker) use ($company) {
|
||||
'description' => $faker->text(100),
|
||||
'purchase_price' => $faker->randomFloat(2, 10, 20),
|
||||
'sale_price' => $faker->randomFloat(2, 10, 20),
|
||||
'category_id' => $company->categories()->type('item')->get()->random(1)->pluck('id')->first(),
|
||||
'category_id' => $company->categories()->item()->get()->random(1)->pluck('id')->first(),
|
||||
'tax_id' => null,
|
||||
'enabled' => $faker->boolean ? 1 : 0,
|
||||
];
|
||||
|
@ -31,13 +31,13 @@ $factory->define(Transaction::class, function (Faker $faker) use ($company) {
|
||||
$factory->state(Transaction::class, 'income', function (Faker $faker) use ($company) {
|
||||
return [
|
||||
'type' => 'income',
|
||||
'category_id' => $company->categories()->type('income')->get()->random(1)->pluck('id')->first(),
|
||||
'category_id' => $company->categories()->income()->get()->random(1)->pluck('id')->first(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Transaction::class, 'expense', function (Faker $faker) use ($company) {
|
||||
return [
|
||||
'type' => 'expense',
|
||||
'category_id' => $company->categories()->type('expense')->get()->random(1)->pluck('id')->first(),
|
||||
'category_id' => $company->categories()->expense()->get()->random(1)->pluck('id')->first(),
|
||||
];
|
||||
});
|
||||
|
Reference in New Issue
Block a user