public function run() { $this->truncateTable('contact_form'); $faker = Faker::create(); $contactIds = Contact::lists('id'); $formIds = Form::lists('id'); for ($i = 0; $i < 20; $i++) { DB::table('contact_form')->insert(['contact_id' => $faker->randomElement($contactIds), 'form_id' => $faker->randomElement($formIds), 'created_at' => $this->now, 'updated_at' => $this->now]); } }
public function run() { $this->truncateTable('form_property'); $this->faker = Faker::create(); $formIds = Form::lists('id'); $propertyIds = Property::lists('id'); for ($i = 0; $i < 40; $i++) { $ids = $this->getUniqueIds($formIds, $propertyIds); DB::table('form_property')->insert(['form_id' => $ids['form_id'], 'property_id' => $ids['property_id'], 'label' => $this->faker->sentence(2), 'default' => $this->faker->word, 'required' => $this->faker->boolean(25), 'created_at' => $this->now, 'updated_at' => $this->now]); } }