commit de compras
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?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);});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user