Search code examples
phplaravel-5laravel-artisanartisan-migrate

A non-numeric value encountered Laravel5.5 on Migration


I am getting this error [ErrorException] A non-numeric value encountered when I give an artisan command php artisan migrate:fresh --seed.

This issue arised when I upgraded to php 7.1 in xammp.

When I am not seeding the error does not occur.

Below is the model factory

$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()
    ];
});

Is there a workaround on this issue?

Thanks in advance


Solution

  • This is the cause of the error: 'firstname' => $faker->firstName($gender = null|'male'|'female'), 'lastname' => $faker->lastName($gender = null|'male'|'female'),

    You can just use: 'firstname' => $faker->firstName(), 'lastname' => $faker->lastName(),

    So that it won't return that error mention above by AbraCadaver