You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

5 months ago
<?php
namespace App\Providers;
use App\Services\Sms\DisabledSmsSender;
use App\Services\Sms\SmsSender;
1 month ago
use App\Services\Sms\SubmailSmsSender;
use App\Services\Sms\TencentCloudSmsSender;
4 months ago
use Illuminate\Support\Facades\URL;
5 months ago
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
$this->app->bind(SmsSender::class, function ($app) {
1 month ago
if (! (bool) config('sms.enabled')) {
return $app->make(DisabledSmsSender::class);
}
return (string) config('sms.driver') === 'tencentcloud'
? $app->make(TencentCloudSmsSender::class)
1 month ago
: $app->make(SubmailSmsSender::class);
});
5 months ago
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
1 month ago
if (str_starts_with((string) config('app.url'), 'https://')) {
4 months ago
URL::forceScheme('https');
}
5 months ago
}
}