zingimmick/laravel-sms

View on GitHub
src/SmsMessage.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace Zing\LaravelSms;

use Illuminate\Bus\Queueable;
use Overtrue\EasySms\Contracts\MessageInterface;
use Overtrue\EasySms\Message;

class SmsMessage extends Message
{
    use Queueable;

    /**
     * @param string|callable $content
     */
    public static function text($content): self
    {
        return (new self([], MessageInterface::TEXT_MESSAGE))->setContent($content);
    }

    /**
     * @param string|callable $content
     */
    public static function voice($content): self
    {
        return (new self([], MessageInterface::VOICE_MESSAGE))->setContent($content);
    }

    /**
     * @param string|callable $template
     * @param mixed[]|callable $data
     */
    public static function fromTemplate($template, $data): self
    {
        return static::text('')->setTemplate($template)->setData($data);
    }
}