/
home
/
old_henza
/
server
/
app
/
Models
/
File Upload :
llllll
Current File: /home/old_henza/server/app/Models/Sms.php
<?php namespace App\Models; use App\DB\Selector; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Http; class Sms extends Model { use HasFactory; use Selector; protected $table = 'messages'; // public $fillable = [ // 'api_token', // 'address', // 'phone', // 'fname', // 'lname', // 'name', // 'mobile', // 'rnd', // 'ncode', // 'notify_count', // 'total_order', // 'gram_level', // 'percent', // 'input', // 'output', // 'remain', // 'rial_remain', // 'rial_output', // 'rial_input', // 'reagent_id', // 'type', // 'open_order', // 'child', // 'sts', // ]; public $fillable = [ 'customer_id', 'mobile', 'massage', 'token', 'type', 'user_id' ]; public static $TYPES = [ -1=>'یک شماره تلفن', 0=>'همه کاربران', 1=>'کارشناسان فروش', 2=>'مشتریان عمده', 9=>'چند شماره تفن', ]; public static function Send($to , $msg,$customer_id = null,$token = null,$type = null,$user_id = null) { $endpoint = "http://www.0098sms.com/sendsmslink.aspx"; $client = new \GuzzleHttp\Client(); $response = $client->request('GET', $endpoint, [ 'query' => [ 'FROM' => 3000164545, 'TO' => $to, 'TEXT' => trim($msg), 'USERNAME' => 'zsms6916', 'PASSWORD' => 'a09121227052A', 'DOMAIN' => '0098', ]]); // $response = $client->request('GET', $endpoint, [ // 'query' => [ // 'FROM' => 50002216953, // 'TO' => $to, // 'TEXT' => trim($msg), // 'USERNAME' => 'dsms7747', // 'PASSWORD' => '28451322', // 'DOMAIN' => '0098', // ]]); self::set($to,$msg,$customer_id,$token,$type,$user_id); return $response; } public static function SendSms($to , $msg,$customer_id = null,$token = null,$type = null,$user_id = null) { $endpoint = "http://www.0098sms.com/sendsmslink.aspx"; $http = Http::get($endpoint,[ 'FROM' => 3000164545, 'TO' => $to, 'TEXT' => trim($msg), 'USERNAME' => 'zsms6916', 'PASSWORD' => 'a09121227052A', 'DOMAIN' => '0098', ])->body(); // $http = Http::get($endpoint,[ // 'FROM' => 50002216953, // 'TO' => $to, // 'TEXT' => trim($msg), // 'USERNAME' => 'dsms7747', // 'PASSWORD' => '28451322', // 'DOMAIN' => '0098', // ])->body(); self::set($to,$msg,$customer_id,$token,$type,$user_id); return $http; } public static function set($mobile,$massage,$customer_id = null,$token = null,$type = null,$user_id = null){ self::create([ 'customer_id'=>$customer_id, 'mobile'=>$mobile, 'massage'=>$massage, 'token'=>$token, 'type'=>$type, 'user_id'=>$user_id ]); } }
Copyright ©2k19 -
Hexid
|
Tex7ure