Home > Net >  I can pass my data to my database. It shows me this error: SQLSTATE[HY000]: General error: 1364 Fiel
I can pass my data to my database. It shows me this error: SQLSTATE[HY000]: General error: 1364 Fiel

Time:12-15

This is my model enter image description here

This is my Controller enter image description here

This is my Route

    Route::post('consultation_form', [ConsultationController::class,'addConsultation']);

CodePudding user response:

This means your not providing a value for the item_name field when you are trying to insert a record for the consultation model.

The input being provided is most likely empty, and MYSQL is giving you an error because your database wasn't setup for that field to have a default value when one isn't provided.

CodePudding user response:

Put

$table->string('item_name')->nullable();

Or if you want a default name.

$table->string('item_name')->default('item_default_name); 
  • Related