getIndex() <= 1) return false; $sex = 0; switch ($row[3]) { case "男": case 'man': $sex = 1; break; case '女': case 'women': $sex = 2; break; } if (empty($row[1])) return false; $data = [ 'turename' => $row[1], 'account' => $row[2], 'faculty' => $row[6], 'class' => $row[7], 'mobile' => $row[4], 'period' => $row[5], 'password' => Str::random(6), 'sex' => $sex, ]; if (Student::query()->where('account', $row[2])->exists()) return false; Student::create($data); return true; } }