I am having a problem with creating notes manually.
Basically, I am trying to seed data into the database and execute it as a job every x minutes or hours. The reason why I want to run it as a job is that I am synchronizing the database based on data I get from an API.
The problem now is when I try to create notes in a job as follows
Note::create([ 'created_at' => Carbon::parse($comment->created), 'text' => $comment->renderedBody, 'system' => 1, 'notable_type' => 'App\Models\Issue', 'notable_id' => $Issue->id, 'created_by' => $user ]);
I get SQLSTATE[HY000]: General error: 1364 Field 'notable_type' doesn't have a default value (Connection: mysql, SQL: insert into 'nova_notes' ('text', 'system', 'created_by', 'updated_at', 'created_at') values (text, 1, 2, 2023-03-16 21:01:31, 2023-03-16 21:01:31))
however, if I do the same thing as a seeder it works. The error shows that not all fields are being inserted but they are there.
Any idea what the problem could be or am I doing something wrong?
I tried to use addNote but it doesn't fulfill my needs
I am having a problem with creating notes manually. Basically, I am trying to seed data into the database and execute it as a job every x minutes or hours. The reason why I want to run it as a job is that I am synchronizing the database based on data I get from an API. The problem now is when I try to create notes in a job as follows
Note::create([ 'created_at' => Carbon::parse($comment->created), 'text' => $comment->renderedBody, 'system' => 1, 'notable_type' => 'App\Models\Issue', 'notable_id' => $Issue->id, 'created_by' => $user ]);
I get
SQLSTATE[HY000]: General error: 1364 Field 'notable_type' doesn't have a default value (Connection: mysql, SQL: insert into 'nova_notes' ('text', 'system', 'created_by', 'updated_at', 'created_at') values (text, 1, 2, 2023-03-16 21:01:31, 2023-03-16 21:01:31))
however, if I do the same thing as a seeder it works. The error shows that not all fields are being inserted but they are there.Any idea what the problem could be or am I doing something wrong? I tried to use addNote but it doesn't fulfill my needs