2016-01-08 08:56:35 -06:00
|
|
|
<?php
|
2016-09-17 00:57:32 -05:00
|
|
|
/**
|
|
|
|
* ModelFactory.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
2016-09-17 00:57:32 -05:00
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
2016-05-20 01:57:45 -05:00
|
|
|
|
2016-09-15 23:19:40 -05:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Model Factories
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here you may define all of your model factories. Model factories give
|
|
|
|
| you a convenient way to create models for testing and seeding your
|
|
|
|
| database. Just tell the factory how a default model should look.
|
|
|
|
|
|
|
|
|
*/
|
2016-05-20 01:57:45 -05:00
|
|
|
|
2016-09-17 00:57:32 -05:00
|
|
|
$factory->define(
|
|
|
|
FireflyIII\User::class, function (Faker\Generator $faker) {
|
2016-09-15 23:19:40 -05:00
|
|
|
static $password;
|
2016-01-08 08:56:35 -06:00
|
|
|
|
|
|
|
return [
|
2016-09-17 00:57:32 -05:00
|
|
|
'email' => $faker->safeEmail,
|
|
|
|
'password' => $password ?: $password = bcrypt('secret'),
|
2016-01-08 08:56:35 -06:00
|
|
|
'remember_token' => str_random(10),
|
|
|
|
];
|
2016-09-17 00:57:32 -05:00
|
|
|
}
|
|
|
|
);
|
2017-03-04 04:20:57 -06:00
|
|
|
|
|
|
|
$factory->define(
|
|
|
|
FireflyIII\Models\Transaction::class, function (Faker\Generator $faker) {
|
|
|
|
return [
|
2017-03-04 08:29:20 -06:00
|
|
|
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
|
|
|
|
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
|
|
|
|
'opposing_account_id' => $faker->numberBetween(1, 10),
|
|
|
|
'source_account_id' => $faker->numberBetween(1, 10),
|
|
|
|
'opposing_account_name' => $faker->words(3, true),
|
|
|
|
'description' => $faker->words(3, true),
|
|
|
|
'source_account_name' => $faker->words(3, true),
|
|
|
|
'destination_account_id' => $faker->numberBetween(1, 10),
|
|
|
|
'destination_account_name' => $faker->words(3, true),
|
|
|
|
'amount' => strval($faker->randomFloat(2, -100, 100)),
|
|
|
|
'budget_id' => 0,
|
|
|
|
'category' => $faker->words(3, true),
|
2017-03-04 04:20:57 -06:00
|
|
|
];
|
|
|
|
}
|
|
|
|
);
|