diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a4c206f..cd3c625 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -7,6 +7,7 @@ use App\Models\User; use App\Models\Customer; use App\Models\Setting; use App\Models\Message; +use App\Services\ConfigService; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; @@ -68,7 +69,9 @@ class Controller extends BaseController public static function SendMessage($to, $msg ,$is_send = false,$force_method ='null') { - $config = config('message', false); + + $config = app(ConfigService::class); +// $config = config('message', false); $credentials = [ "telegram" => [ "token" => self::Config('telegram_bot_token') @@ -122,7 +125,7 @@ class Controller extends BaseController //SMS if ($send_sms or $force_method=="sms") { - $endpoint = "https://www.0098sms.com/sendsmslink.aspx"; +/* $endpoint = "https://www.0098sms.com/sendsmslink.aspx"; $response = Http::withoutVerifying()->get($endpoint, [ 'FROM' => $credentials['sms']['sender'], 'TO' => $to, @@ -131,7 +134,26 @@ class Controller extends BaseController 'PASSWORD' => $credentials['sms']['password'], 'DOMAIN' => '0098', ]); - $platforms[] = "0098:{$to}"; + $platforms[] = "0098:{$to}";*/ + + $response = Http::timeout(15) + ->withHeaders([ + 'Content-Type' => 'application/json', + 'secret_key' => 'f21debfb-83ac-4624-a2f4-f08375043181', + ]) + ->withOptions([ + 'curl' => [ + CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, + ] + ]) + ->post('http://185.231.112.101/api/createsms', [ + 'phone' => $to, + 'host' => $config->Config('name_fa') ?? gethostname(), + 'text' => trim($msg), + 'platform' => 'rayegansms', + ]); + + $platforms[] = "rayegansms:{$to}"; }