students; } public function update(Model $model, array $data) { $model->students->each(function ($item, $key) use ($data, $model) { if ($data['score' . $item->id]) { $model->students()->syncWithoutDetaching([$item->id => ['score' => $data['score' . $item->id]]]); } }); return $model; } public function delete(Model $model) { // TODO: Implement delete() method. } public function create(array $data) { // TODO: Implement create() method. } }