Add factory for Earning model
MODIFY
database/factories/ModelFactory.php
database/factories/ModelFactory.php
use Faker\Generator;
use App\User;
+use App\Earning;
use App\Spending;
$factory->define(User::class, function (Generator $faker) {
@@ -13,6 +14,14 @@ $factory->define(User::class, function (Generator $faker) {
];
});
+$factory->define(Earning::class, function (Generator $faker) {
+ return [
+ 'happened_on' => $faker->dateTimeBetween('-50 days', 'now')->format('Y-m-d'),
+ 'description' => implode(' ', array_map('ucfirst', $faker->words(3))),
+ 'amount' => $faker->randomNumber(3)
+ ];
+});
+
$factory->define(Spending::class, function (Generator $faker) {
return [
'happened_on' => $faker->dateTimeBetween('-50 days', 'now')->format('Y-m-d'),

Add factory for Earning model