public function store() { $user = User::where('account', $this->request->account)->first(); if ($user) { return $this->response->ok(['error_code' => 1]); } $user = User::create($this->request->all); $user->info()->create(['name' => '']); return $this->response->ok(['error_code' => 0]); }
public function run() { $data = []; for ($i = 0; $i < 5; $i++) { $faker = \Faker\Factory::create(); $tmp = []; $tmp['account'] = $faker->userName; $tmp['password'] = $faker->password; $data[] = $tmp; } User::insert($data); }