Skip to content

[FEAT] Resolve trashed relationships in Ledger records

Quetzy Garcia requested to merge feat/resolve-trashed-relationships into master

Until now, Ledger records with trashed (soft deleted) relations would require the user to implement a custom Ledger model where trashed relationships need to be explicit:

/**
 * {@inheritdoc}
 */
public function recordable()
{
    return $this->morphTo()->withTrashed();
}

/**
 * {@inheritdoc}
 */
public function user()
{
    return $this->morphTo()->withTrashed();
}

That means that all potential relationships need to use the SoftDeletes trait, otherwise problems would happen (see #21 (closed)).

With the changes made to the Ledger trait, the user no longer has to worry about resolving trashed relations.

Work done:

  • Add resolveTrashedRelation() method to Ledger trait;
  • Update tests;
  • Update documentationm;
Edited by Quetzy Garcia

Merge request reports