public function save($postId) { $this->each(function ($item) use($postId) { if (in_array($item->meta_key, $this->changedKeys)) { $item->post_id = $postId; $item->save(); } }); }