/** * Run the database seeds. * * @return void */ public function run() { DB::table('trackings')->truncate(); $faker = Faker::create(); foreach (range(1, 20) as $index) { Tracking::create(['image_url' => $faker->imageUrl(640, 480, 'city'), 'facing_id' => Facing::find($faker->numberBetween(1, 20))->id]); } foreach (range(21, 30) as $index) { Tracking::create(['image_url' => $faker->imageUrl(640, 480, 'city'), 'state' => 'Inserted', 'inserted_at' => Carbon::now(), 'facing_id' => Facing::all()->get($faker->numberBetween(1, 20))->id, 'product_id' => Product::all()->get($faker->numberBetween(1, 20))->id, 'brand_id' => Brand::all()->get($faker->numberBetween(1, 20))->id, 'user_id' => User::all()->get($faker->numberBetween(1, 10))->id]); } }