Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加动态配置短信模板 #168

Open
nonrk opened this issue Jan 26, 2018 · 1 comment
Open

增加动态配置短信模板 #168

nonrk opened this issue Jan 26, 2018 · 1 comment

Comments

@nonrk
Copy link

nonrk commented Jan 26, 2018

在SmsManger类下增加
//存储动态配置模板
protected $templates =[];
//配置方法
public function options($arg){ $this->templates=$arg; }
//修改
protected function generateTemplates($type)
{

if(count($this->templates)!=0){ //判断是否使用动态配置模板
$templates =$this->templates;
}
else
{
$templates = config('laravel-sms.templates');
}

//...
}
在发送前使用,这样可选择每次发送的短信模板
$options=[
‘Aliyun’=>'SMS_xxxxxx',
];
SmsManger::options($options);

@cannycophp
Copy link

赞,感觉不应该修改原生方法,但是这个smsmanager又不提供需要的方法可以去继承。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants