Why is it so that every time I try to post an empty input that has an integer as data type within my migration(s), I get this error:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value
My migration:
public function up()
{
Schema::table('dossiers', function (Blueprint $table) {
$table->integer('amount_of_cilinders')->nullable();
$table->integer('amount_of_doors')->nullable();
$table->integer('manufacturing_year')->nullable();
$table->integer('manufacturing_month')->nullable();
$table->date('date_first_admission')->nullable();
$table->integer('weight')->nullable();
$table->integer('power')->nullable();
});
}
My controller:
public function update(Request $request, Dossier $dossier)
{
$this->validate($request, [
'date_first_admission' => 'date',
]);
$dossier->update($request->all());
return redirect('/dossiers/' . $dossier->id);
}
Update:
I decided to change the datatype to string
since I'm not using these columns anywhere else..
E.g. $table->string('power')->nullable();
request()->all()
to make us show whats in it... – Saumya Rastogi