public function run() { $count = 5001; foreach ($this->producers as $producer) { try { User::create(['name' => $producer['name'], 'doc' => $producer['doc'], 'tel' => $producer['tel'], 'username' => $producer['tel'] ? $producer['tel'] : $count, 'password' => 123, 'type' => 'producer', 'municipality_id' => 685, 'email' => null]); if (!$producer['tel']) { $count++; } } catch (QueryException $e) { } } }
public function run() { $count = 6001; foreach ($this->shopkeepers as $shopkeeper) { try { $user = User::create(['name' => $shopkeeper['name'], 'tel' => $shopkeeper['tel'], 'address' => $shopkeeper['address'], 'commune' => $shopkeeper['commune'], 'username' => $shopkeeper['tel'] ? $shopkeeper['tel'] : $count, 'password' => 123, 'type' => 'shopkeeper', 'municipality_id' => 685, 'email' => null]); if (!$shopkeeper['tel']) { $count++; } ShoppingInterest::create(['product_id' => 1, 'user_id' => $user->id, 'amount' => $shopkeeper['papa'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 2, 'user_id' => $user->id, 'amount' => $shopkeeper['yuca'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 3, 'user_id' => $user->id, 'amount' => $shopkeeper['arracacha'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 7, 'user_id' => $user->id, 'amount' => $shopkeeper['platano'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 11, 'user_id' => $user->id, 'amount' => $shopkeeper['hortalizas'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 20, 'user_id' => $user->id, 'amount' => $shopkeeper['frutas'], 'unit' => 'kg']); } catch (QueryException $e) { } } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create($data); }