A non-numeric value encountered Laravel5.5 on Migration

Multi tool use
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
.
[ErrorException] A non-numeric value encountered
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(AppClients::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
I have eddited my question
– kikuyu1
Sep 28 '17 at 18:45
It's a new notice/warning in 7.1 when strings are coerced using operators expecting numbers or their assignment equivalents.
– AbraCadaver
Sep 28 '17 at 18:49
What can I do to make it work?
– kikuyu1
Sep 28 '17 at 18:54
You have to find the code that is trying to use arithmetic on a non-number. It doesn't give a file and line number?
– AbraCadaver
Sep 28 '17 at 18:55
1 Answer
1
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
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What is the code?
– AbraCadaver
Sep 28 '17 at 18:36