firefly-iii/database/factories/ModelFactory.php

53 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/**
* ModelFactory.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* 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.
*/
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
$factory->define(
FireflyIII\User::class, function (Faker\Generator $faker) {
2016-09-15 23:19:40 -05:00
static $password;
return [
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
}
);
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
];
}
);