public function run() { $faker = Faker::create(); foreach (range(1, 50) as $index) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $tag = Tag::orderBy(DB::raw('RAND()'))->first()->id; $array = ['tag_id' => $tag, 'taggable_id' => $event, 'taggable_type' => 'EventModel']; DB::table('taggables')->insert($array); } }
public function run() { DB::table('comments')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 1; $i++) { $user = User::orderBy(DB::raw('RAND()'))->first()->id; $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; // $post = Event::orderBy(DB::raw('RAND()'))->first()->id; $comments = array(['user_id' => $user, 'commentable_id' => $faker->randomElement([$event]), 'commentable_type' => $faker->randomElement(['EventModel']), 'content' => $faker->sentence(30), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('comments')->insert($comments); } }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('photos')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 50; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $images = array(['name' => $faker->imageUrl(120, 120), 'imageable_id' => $event, 'imageable_type' => $faker->randomElement(['EventModel', 'Blog']), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); // DB::table('photos')->insert($images); } // Uncomment the below to run the seeder }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('favorites')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 30; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $user = User::orderBy(DB::raw('RAND()'))->first()->id; $favorites = array(['user_id' => $user, 'event_id' => $event, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('favorites')->insert($favorites); } // Uncomment the below to run the seeder }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('subscriptions')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 40; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $subscriptions = array(['event_id' => $event, 'type' => $faker->randomElement(['FREE', 'PAID']), 'approval_type' => $faker->randomElement(['DIRECT', 'MOD']), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('types')->insert($subscriptions); } // Uncomment the below to run the seeder // $this->updateEventsTable(); }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('subscriptions')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 2; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $user = User::orderBy(DB::raw('RAND()'))->first()->id; $subscriptions = array(['user_id' => $user, 'subscribable_id' => $event, 'subscribable_type' => $faker->randomElement(['Event', 'Package']), 'status' => '', 'registration_type' => $faker->randomElement(['VIP', 'ONLINE']), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('subscriptions')->insert($subscriptions); } // Uncomment the below to run the seeder // $this->updateEventsTable(); }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('settings')->truncate(); $faker = Faker\Factory::create(); for ($i = 0; $i < 1; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $user = User::orderBy(DB::raw('RAND()'))->first()->id; $subscriptions = array(['approval_type' => 'DIRECT', 'registration_types' => 'VIP,ONLINE', 'vip_total_seats' => '200', 'online_total_seats' => '100', 'online_available_seats' => '100', 'vip_available_seats' => '200', 'settingable_id' => $event, 'settingable_type' => 'EventModel', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('settings')->insert($subscriptions); } // Uncomment the below to run the seeder // $this->updateEventsTable(); }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('event_prices')->truncate(); for ($i = 0; $i < 3; $i++) { $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id; $country = ['1' => 1, '2' => 2]; $price = [200, 300, 400, 500, 600]; $registration_types = ['VIP' => 'VIP', 'NORMAL' => 'NORMAL', 'ONLINE' => 'ONLINE']; $k = array_rand($price); $favorites = array(['country_id' => array_rand($country), 'event_id' => $event, 'price' => $price[$k], 'type' => array_rand($registration_types), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('event_prices')->insert($favorites); } // Uncomment the below to run the seeder }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('followers')->truncate(); $dt = Carbon::now(); $dateNow = $dt->toDateTimeString(); $faker = Faker\Factory::create(); for ($i = 0; $i < 40; $i++) { $this->setEvent(EventModel::orderBy(DB::raw('RAND()'))->first()->id); $this->setUser(User::orderBy(DB::raw('RAND()'))->first()->id); // $this->checkUnique(); $followers = array(['user_id' => $this->getUser(), 'event_id' => $this->getEvent(), 'created_at' => $dateNow, 'updated_at' => $dateNow]); DB::table('followers')->insert($followers); } // Uncomment the below to run the seeder }