¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -2,18 +2,21 @@
namespace Modules\Sms\Facades;
use Modules\Sms\GatewayManager;
use Modules\Sms\GatewayInterface;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Facade;
/**
* @method static \Illuminate\Support\Collection all()
* @method static Collection all()
* @method static array names()
* @method static \Modules\Sms\GatewayInterface get(string $name)
* @method static \Modules\Sms\GatewayManager register(string $name, callable|object $driver)
* @method static GatewayInterface get(string $name)
* @method static GatewayManager register(string $name, callable|object $driver)
* @method static int count()
* @method static bool isEmpty()
* @method static bool isNotEmpty()
*
* @see \Modules\Sms\GatewayManager
* @see GatewayManager
*/
class Gateway extends Facade
{
@@ -24,6 +27,6 @@ class Gateway extends Facade
*/
protected static function getFacadeAccessor()
{
return \Modules\Sms\GatewayManager::class;
return GatewayManager::class;
}
}

View File

@@ -6,5 +6,6 @@ interface GatewayInterface
{
public function client();
public function send(string $to, string $message);
}

View File

@@ -6,14 +6,13 @@ use Exception;
use Twilio\Rest\Client;
use Modules\Sms\GatewayInterface;
use Modules\Sms\Exceptions\SmsException;
use Twilio\Exceptions\ConfigurationException;
class Twilio implements GatewayInterface
{
public function client()
{
return new Client(setting('twilio_sid'), setting('twilio_token'));
}
/**
* @throws SmsException
*/
public function send(string $to, string $message)
{
try {
@@ -28,4 +27,13 @@ class Twilio implements GatewayInterface
throw new SmsException('Twilio: ' . $e->getMessage());
}
}
/**
* @throws ConfigurationException
*/
public function client()
{
return new Client(setting('twilio_sid'), setting('twilio_token'));
}
}

View File

@@ -11,13 +11,6 @@ use Modules\Sms\Exceptions\SmsException;
class Vonage implements GatewayInterface
{
public function client()
{
return new Client(
new Basic(setting('vonage_key'), setting('vonage_secret'))
);
}
public function send(string $to, string $message)
{
try {
@@ -28,4 +21,12 @@ class Vonage implements GatewayInterface
throw new SmsException('Vonage: ' . $e->getMessage());
}
}
public function client()
{
return new Client(
new Basic(setting('vonage_key'), setting('vonage_secret'))
);
}
}

View File

@@ -16,7 +16,7 @@ class SmsServiceProvider extends ServiceProvider
*/
public function boot()
{
if (! config('app.installed')) {
if (!config('app.installed')) {
return;
}

View File

@@ -1,8 +1,8 @@
<?php
return [
'welcome' => "Welcome :first_name,\nYour account has been created successfully.",
'new_order' => 'A new order has been placed. The order id is #:order_id.',
'order_has_been_placed' => "Hi :first_name,\nYour order #:order_id has been placed. Thanks for shopping with us.",
'order_status_changed' => "Hi :first_name,\nYour order #:order_id status is changed to :status.",
'welcome' => "Welcome :first_name,\nYour account has been created successfully",
'new_order' => 'A new order has been placed. The order id is #:order_id',
'order_has_been_placed' => "Hi :first_name,\nYour order #:order_id has been placed. Thanks for shopping with us",
'order_status_changed' => "Hi :first_name,\nYour order #:order_id status is changed to :status",
];

View File

@@ -8,7 +8,7 @@ class Sms
{
public static function send($to, $message)
{
if (! setting('sms_service')) {
if (!setting('sms_service')) {
return;
}