I want to be able to save many rows in a row in a table, i have read that this can be done using the create
method, but I am getting this error when trying to using the method
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (SQL: insert into
person_roles
(updated_at
,created_at
) values (2019-01-30 07:46:19, 2019-01-30 07:46:19))
my code
$data = [
['name' => 'actor'],
['name' => 'translator'],
['name' => 'director'],
['name' => 'stageDirector'],
['name' => 'costume'],
['name' => 'musical'],
['name' => 'supportDirector'],
['name' => 'photographer'],
['name' => 'choreographer'],
];
$personRoles = PersonRole::create($data);
I my using Laravel v5.7.21
Updated, inside my PersonRole i have added this line
protected $fillable = ['name'];
in order for the mass assigning to work, but I am still getting the error.