/** * Run the database seeds. * * @return void */ public function run() { $types = App\Markets\Type::all(); $faker = Faker\Factory::create(); foreach ($types as $type) { for ($count = 0; $count < 11; $count++) { $title = $faker->sentence(); Market::create(['type_id' => $type->id, 'title' => $title, 'slug' => str_slug($title), 'description' => $faker->paragraph, 'start_at' => Carbon::now()->addWeeks($count), 'end_at' => Carbon::now()->addWeeks($count + 1)]); } } }
/** * Run the database seeds. * * @return void */ public function run() { $markets = Market::get(); foreach ($markets as $market) { for ($count = 0; $count < 7; $count++) { if ($count == 0) { $date = $market->start_at; } else { $date = $market->start_at->addDays($count); } Time::create(['market_id' => $market->id, 'start' => Carbon::now()->setDate($date->year, $date->month, $date->day)->setTime(07, 00, 00)->toDateTimeString(), 'end' => Carbon::now()->setDate($date->year, $date->month, $date->day)->setTime(16, 00, 00)->toDateTimeString()]); } } }