Commit ee8d07de authored by beardedwarrior's avatar beardedwarrior

added seed data for projects and deposits, corrected the time_received to be date time

parent c2bb119c
<?php
use Faker\Generator as Faker;
$factory->define(\App\Deposit::class, function (Faker $faker) {
return [
'payment_id' => $faker->sha256,
'amount' => $faker->randomNumber(2),
'time_received' => $faker->dateTime,
'tx_id' => $faker->sha256,
'block_received' => $faker->randomNumber(),
];
});
<?php
use Faker\Generator as Faker;
$factory->define(\App\Project::class, function (Faker $faker) {
return [
'payment_id' => $faker->sha256,
'target_amount' => $faker->randomNumber(),
'status' => $faker->randomElement(['new', 'open', 'funded']),
'created_at' => $faker->dateTime,
'updated_at' => $faker->dateTime,
];
});
<?php
use Illuminate\Database\Seeder;
class ProjectsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(\App\Project::class, 20)->create()->each(function ($p) {
$p->deposits()->saveMany(factory(\App\Deposit::class, rand(0,12))->make(['payment_id' => $p->payment_id]));
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment