wishlist - link an object with a transaction
baradhili opened this issue · 2 comments
baradhili commented
It would be nice to be able to link an object with a transaction. This gives the ability to store a voucher with a transaction or at least a receipt image etc.
accounting does this -
/**
* Set reference object.
*
* @param Model $object
* @return JournalTransaction
*/
public function referencesObject($object)
{
$this->ref_class = get_class($object);
$this->ref_class_id = $object->id;
$this->save();
return $this;
}
/**
* Get reference object.
*
* @return \Illuminate\Database\Eloquent\Collection|Model|Model[]|null
*/
public function getReferencedObject()
{
/**
* @var Model $_class
*/
$_class = new $this->ref_class;
return $_class->find($this->ref_class_id);
}
ekmungai commented
ekmungai commented
Hi @baradhili,
Good news, the latest release now supports adding attachments to Transactions. Just add the id of the model to attachment_id
and its class/type to attachment_type
and you can access it via $transaction->attachment
.
Cheers,
Ed