Failed to run query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'MoneyMethod' cannot be null

 The 'field name' in form and the column name of database was different. My problem was:
      "Integrity constraint violation: 1048 Column 'MoneyMethod' cannot be null".
My form input tag:
 {!! Form::select("MoneyMethod", $MoneymethodInfo, null,["class"=>"form-control MoneyMethod required","id"=>"MoneyMethod"]) !!}
Nnotice the spelling of 'MoneyMethod' and in my database table
$table->string('MoneyMethod', 100); 
the spelling of 'MoneyMethod' is same as form but in my controller
$riskfund->Moneymethod  = Input::get('Moneymethod');
look carefully the spelling of 'Moneymethod' differs from my form and database table column. After correcting the spelling, it is working now.
So, please check the spelling of the spelling of the field  in form, controller, database table for which you are facing the problem. it may help you.

Comments

Popular posts from this blog

composer installation on aws ec2 instance ami ubuntu 18.04

nginx installation on aws ec2 instance ami ubuntu 18.04

PHP7.3 installation on aws ec2 instance ami ubuntu 18.04