Deploy Ladill Events / deploy (push) Successful in 41s
Events can define hybrid/virtual sessions synced to Meet rooms; SMS and email use wallet-billed platform APIs instead of Termii and Laravel mail. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
595 B
PHP
25 lines
595 B
PHP
<?php
|
|
|
|
namespace App\Services\Billing;
|
|
|
|
class SmsService
|
|
{
|
|
public function __construct(private readonly PlatformSmsClient $platform) {}
|
|
|
|
public function send(string $ownerPublicId, string $to, string $message): void
|
|
{
|
|
$phone = preg_replace('/\D+/', '', $to);
|
|
if (strlen($phone) < 9) {
|
|
return;
|
|
}
|
|
|
|
if (strlen($phone) === 9) {
|
|
$phone = '233'.$phone;
|
|
} elseif (str_starts_with($phone, '0')) {
|
|
$phone = '233'.substr($phone, 1);
|
|
}
|
|
|
|
$this->platform->send($ownerPublicId, $phone, $message);
|
|
}
|
|
}
|