Files
2026-11-04 09:37:20 +02:00

19 lines
742 B
PHP

<?php
namespace App\Modules\Purchasing;
use Tempo\Purchasing\Embedded\Models\AuditLog;
/** A stage's history must not become a back door into downstream financial payloads. */
final class ProcessHistory
{
public function query(int $request,string $stage)
{
$patterns=match($stage){
'requests'=>['requisition.%','sgf.request.command'],
'sourcing'=>['requisition.%','sgf.request.command','quotation.%','award.%','sgf.sourcing.command'],
default=>throw new \InvalidArgumentException('Unknown history stage'),
};
return AuditLog::where('requisition_id',$request)->where(function($q)use($patterns){foreach($patterns as$pattern)$q->orWhere('action','like',$pattern);});
}
}