I just started laravel and all I want to do is get following query working in Eloquent:
INSERT INTO geschichte (geschic
Most of what is in your controller should not be necessary. I am also a little concerned about the database structure you are using as to why you would perform a task like shown in your controller. The following should be all you need:
public function alterGeschichte(Request $request)
{
Geschichte::updateOrCreate(
['id' => 1],
['id' => 1, 'geschichte_text1' => $request->geschichte_text1]
);
Geschichte::updateOrCreate(
['id' => 2],
['id' => 2, 'geschichte_text2' => $request->geschichte_text2]
);
Geschichte::updateOrCreate(
['id' => 3],
['id' => 3, 'geschichte_text3' => $request->geschichte_text3]
);
return redirect('/geschichte');
}
If these are creating new records it is most likely because there is no record with those ID's.