迁移时遇到非数字值 Laravel5.5

A non-numeric value encountered Laravel5.5 on Migration

当我发出 artisan 命令 php artisan migrate:fresh --seed.

时,我收到此错误 [ErrorException] A non-numeric value encountered

当我在 xammp 中升级到 php 7.1 时出现了这个问题。

当我不播种时,不会发生错误。

下面是模型工厂

$factory->define(App\Clients::class, function (Faker $faker) {
    return [
        'firstname' => $faker->firstName($gender = null|'male'|'female'),
        'lastname' => $faker->lastName($gender = null|'male'|'female'),
        'email' => $faker->unique()->safeEmail,
        'phone' => $faker->e164PhoneNumber(),
        'country' => $faker->country(),
        'university' => $faker->city()
    ];
});

这个问题有解决方法吗?

提前致谢

错误原因如下: 'firstname' => $faker->firstName($gender = null|'male'|'female'), 'lastname' => $faker->lastName($gender = null|'male'|'female'),

您可以只使用: 'firstname' => $faker->firstName(), 'lastname' => $faker->lastName(),

这样它就不会 return AbraCadaver

上面提到的那个错误