Untitled
unknown
plain_text
2 years ago
502 B
9
Indexable
$r = $r->filter(function ($rs) {
// Get last transaction - no refunds, voids, or pdfs, amount > $1
$last = $rs->transactions()->whereNotIn('type', ['refund', 'void'])->where('amount', '>', 1)->whereNotIn('set', ['pdf', 'ownership'])->latest()->first();
// If last transaction is an approval, return true (keep it in the array)
if ($last !== null && in_array($last->type, Transaction::$approvals)) {
return true;
} else {
// Otherwise filter it out
return false;
}
});Editor is loading...