im trying to insert records in my database using tinker but i have an error : Php warning : a non-numeric value encountered and no records are save.
My factory :
$factory->define(App\Donne::class, function (Faker\Generator $faker) {
return [
'nom_destinataire' => $faker->firstName($gender = null|'male'|'female'),
'adresse_destinataire' => $faker->address,
'code_postal' => $faker->postcode,
'localite_destinataire' => $faker->country,
'port'=>$faker->randomLetter,
];
My tinker command
factory(App\Donne::class, 1)->create();
Thanks for help
The examples in the package readme here are for demonstrating the available options that can be passed to a function
title($gender = null|'male'|'female') // 'Ms.'
titleMale // 'Mr.'
titleFemale // 'Ms.'
suffix // 'Jr.'
name($gender = null|'male'|'female') // 'Dr. Zane Stroman'
firstName($gender = null|'male'|'female') // 'Maynard'
firstNameMale // 'Maynard'
firstNameFemale // 'Rachel'
lastName // 'Zulauf'
DO NOT COPY PASTE,
|
means (either...or) in plain English
firstName
function only accepts one optional argument, remove it if you want generated data to be either male or female randomly
$factory->define(App\Donne::class, function (Faker\Generator $faker) {
return [
'nom_destinataire' => $faker->firstName(),
'adresse_destinataire' => $faker->address,
'code_postal' => $faker->postcode,
'localite_destinataire' => $faker->country,
'port' => $faker->randomLetter,
];
});
Hope this helps