feat: Add tagging system for SMS logs and templates
- Introduced a `tag` field in the `SmsLog` entity to categorize SMS messages. - Updated the `SmsService` to handle the new `tag` parameter during SMS dispatch. - Implemented a `SmsTextResolver` service to resolve SMS message templates based on tags. - Created a new `SmsMessageTemplate` entity for editable SMS templates with placeholders. - Added endpoints for managing SMS message templates in the admin panel. - Enhanced existing SMS dispatching methods across various controllers to utilize the tagging system. - Migrated the database to include the new `tag` field and created a seeding command for default SMS templates. - Updated admin API to filter SMS logs by tag and include tag information in responses.
This commit is contained in:
@@ -33,9 +33,10 @@ class SmsService
|
||||
?string $templateUuid = null,
|
||||
array $templateVars = [],
|
||||
?string $templateCode = null,
|
||||
string $tag = SmsLog::TAG_GLOBAL,
|
||||
): void {
|
||||
$this->bus->dispatch(new SendSmsMessage(
|
||||
$mobile, $message, $provider, $templateUuid, $templateVars, $templateCode
|
||||
$mobile, $message, $provider, $templateUuid, $templateVars, $templateCode, $tag
|
||||
));
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ class SmsService
|
||||
? $provider->sendTemplate($msg->mobile, $msg->templateCode, $msg->templateVars)
|
||||
: $provider->send($msg->mobile, $msg->message);
|
||||
|
||||
$log = new SmsLog($msg->mobile, $msg->message, $provider->getName(), $success);
|
||||
$log = new SmsLog($msg->mobile, $msg->message, $provider->getName(), $success, $msg->tag);
|
||||
if ($msg->templateUuid) $log->setTemplateUuid($msg->templateUuid);
|
||||
$this->logRepo->save($log);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user