I think you're mixing up some stuff here. First of all you already have the id in the url. This means you don't have to add the $id parameter in the function. The route model binding with Event $event is already taking care of this!
public function update(Request $request, Event $event)
{
$request->validate([
'id' => 'required',
'title' => 'required|max:30',
'description' => 'required|max:455',
'place' => 'required',
'time_happening' => 'date',
]);
$event->updateFromArray($request->toArray());
return response()->json($event);
}
Now if you look at the update method you do something strange here. You're also updating the id. You already have the event object with the id, so you don't have to do that.
public function updateFromArray($data)
{
$this->id = $data['id'];
$this->title = $data['title'];
$this->description = $data['description'];
$this->place = $data['place'];
$this->time_happening = $data['time_happening'];
$this->created_by = $data['created_by'];
$this->group_id = $data['group_id'];
$this->save();
return $this;
}
However you could even do this instead
public function updateFromRequest(Request $request)
{
$this->update($request->except('id'));
return $this;
}
This will do the same thing as the other method above!