- Add /api/rules CRUD, nested actions, and expr validation - Add rules migration, models, and RuleEngine/Expression services - Run ORDER_CREATED rules after order create (non-blocking) and refresh tests - Update OpenAPI tags/schemas/paths and bundled docs
41 lines
917 B
PHP
41 lines
917 B
PHP
<?php
|
|
|
|
namespace App\Models\Rule;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class RuleActionModel extends BaseModel
|
|
{
|
|
protected $table = 'ruleaction';
|
|
protected $primaryKey = 'RuleActionID';
|
|
protected $allowedFields = [
|
|
'RuleID',
|
|
'Seq',
|
|
'ActionType',
|
|
'ActionParams',
|
|
'CreateDate',
|
|
'EndDate',
|
|
];
|
|
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'CreateDate';
|
|
protected $updatedField = '';
|
|
|
|
protected $useSoftDeletes = true;
|
|
protected $deletedField = 'EndDate';
|
|
|
|
public function getActiveByRuleIDs(array $ruleIDs): array
|
|
{
|
|
if (empty($ruleIDs)) {
|
|
return [];
|
|
}
|
|
|
|
return $this->whereIn('RuleID', $ruleIDs)
|
|
->where('EndDate IS NULL')
|
|
->orderBy('RuleID', 'ASC')
|
|
->orderBy('Seq', 'ASC')
|
|
->orderBy('RuleActionID', 'ASC')
|
|
->findAll();
|
|
}
|
|
}
|