public function patch($properties) { foreach ($properties as $key => $value) { if (!in_array($key, $this->patchable)) { throw new Exception("Cannot patch {$key}"); } $this->{$key} = $value; } $this->save(); }