added more scopes

This commit is contained in:
denisdulici
2020-05-03 11:15:56 +03:00
parent 70bfe8c524
commit 430c092ebe
32 changed files with 115 additions and 49 deletions

View File

@ -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(),
];
});