简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM