the problem is that tinker is not wrapping the content in a string
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'address_line_2' doesn't have a default value (SQL: insert into
Test
(name
,gender
,mobile_phone
,alternate_phone
,status
,address_line_1
,updated_at
,created_at
) values (emitchell, dariana66@hotmail.com, Kendra Friesen, Ole Carter, Gennaro Hickle, Prof. Brandon Herman PhD, 2018-12-21 01:07:12, 2018-12-21 01:07:12))'
if I add the quotes manually to every value like
values ('emitchell', 'dariana66@hotmail.com', 'Kendra
Friesen', 'Ole Carter', 'Gennaro Hickle', 'Prof. Brandon Herman PhD',
'2018-12-21 01:07:12', '2018-12-21 01:07:12')
It works
how can I make the random content generate by tinker being in quotes?
I even use (string)
$factory->define(App\Test::class, function (Faker $faker) {
return [
'name' => (string)$faker->sentence(),
'gender' => (string)$faker->sentence(),
'mobile_phone' => (string)$faker->sentence(),
'alternate_phone' => (string)$faker->sentence(),
'status' => (string)$faker->sentence(),
'address_line_1' => (string)$faker->sentence(),
'address_line_2' => (string)$faker->sentence(),
'town_city' => (string)$faker->sentence(),
'postscode' => (string)$faker->sentence(),
'notes' => (string)$faker->sentence()
];
});
or examples from the github page
'name' => $faker-> sentence($nbWords = 6, $variableNbWords = true), // 'Sit vitae voluptas sint non voluptates.'
it wont output string values...
what is going on ?