@galiavni You can do this:
public function medications()
{
return $this->belongsToMany('Medication', 'patient_medication')->withPivot('id', ... other fields you need)->withTimestamps();
}
// then
$patient->medications->first()->pivot->id; // this is what you need, so pass it in the form
// upon update
$patient->medications()
->newPivotStatement()
->where('id', $id)->update(....)
Mind that newPivotStatement will be instance of Query\Builder, ie. no Eloquent features, no timestamp auto update.
Alternatively, depending on your app, you could rely on the timestamp of the association:
$patient->medications->first()->pivot->created_at; // that's what we need, again passed to the update controller
$patient->medications()
->newPivotStatementForId($medicationId)
->where('created_at', $createdAt)
->update( .... ); // again, raw `Query\Builder` object, so you need to take care of `updated_at` column
// for consistency you can use freshTimestamp for the updated_at field
$updatedAt = $patient->freshTimestamp();