mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Create bills in test data, sort them [skip ci]
This commit is contained in:
parent
3aacb6f5f3
commit
e0d863a46f
@ -93,6 +93,12 @@ class BillRepository implements BillRepositoryInterface
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->bills()->orderBy('name', 'ASC')->get();
|
||||
|
||||
$set = $set->sortBy(
|
||||
function (Bill $bill) {
|
||||
return strtolower($bill->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ class TestDataSeeder extends Seeder
|
||||
$this->createAssetAccounts();
|
||||
$this->createExpenseAccounts();
|
||||
$this->createRevenueAccounts();
|
||||
$this->createBills();
|
||||
|
||||
// dates:
|
||||
$start = Carbon::now()->subyear()->startOfMonth();
|
||||
@ -173,6 +174,38 @@ class TestDataSeeder extends Seeder
|
||||
}
|
||||
}
|
||||
|
||||
public function createBills()
|
||||
{
|
||||
Bill::create(
|
||||
[
|
||||
'name' => 'Rent',
|
||||
'match' => 'rent,land,lord',
|
||||
'amount_min' => 795,
|
||||
'amount_max' => 805,
|
||||
'user_id' => $this->user->id,
|
||||
'date' => '2015-01-01',
|
||||
'active' => 1,
|
||||
'automatch' => 1,
|
||||
'repeat_freq' => 'monthly',
|
||||
'skip' => 0,
|
||||
]
|
||||
);
|
||||
Bill::create(
|
||||
[
|
||||
'name' => 'Health insurance',
|
||||
'match' => 'zilveren,kruis,health',
|
||||
'amount_min' => 120,
|
||||
'amount_max' => 140,
|
||||
'user_id' => $this->user->id,
|
||||
'date' => '2015-01-01',
|
||||
'active' => 1,
|
||||
'automatch' => 1,
|
||||
'repeat_freq' => 'monthly',
|
||||
'skip' => 0,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $description
|
||||
* @param Carbon $date
|
||||
@ -499,7 +532,7 @@ class TestDataSeeder extends Seeder
|
||||
$toAccount = $this->findAccount('Cafe Central');
|
||||
$category = Category::firstOrCreateEncrypted(['name' => 'Drinks', 'user_id' => $this->user->id]);
|
||||
$budget = Budget::firstOrCreateEncrypted(['name' => 'Going out', 'user_id' => $this->user->id]);
|
||||
$amount = rand(1500, 3600) / 100;
|
||||
$amount = rand(1500, 3600) / 100;
|
||||
$journal = TransactionJournal::create(
|
||||
[
|
||||
'user_id' => $this->user->id,
|
||||
|
Loading…
Reference in New Issue
Block a user