---
### 一、 laravel 配置 easy-sms
#### 首先下载地址是下面这个地址, 安装要求进行下载配置
https://github.com/yl/easysms-notification-channel
> 步骤
composer require leonis/easysms-notification-channel
$ php artisan vendor:publish --provider="Leonis\Notifications\EasySms\EasySmsChannelServiceProvider"
vim config/easysms.php //生成的配置文件
### 二、 配置阿里云短信验证接口
> 登录到官网中, 我们需要创建一个签名和一个模板


> ####`这里真的很重要需要一个备案的服务器和一页页面,最好是注册或者登录审核很严格我真的提交了N次`
> 创建一个用户访问权限, 点击访问控制

> ####进入到以后创建一个用户

> #### 添加权限

> #### 把获取的 获取 `access_key_id` 和 `access_key_secret` 放入 `easysms.php`
'aliyun' => [
'access_key_id' => '123456',
'access_key_secret' => '123456',
'sign_name' => 'cxx1Reg',
],
### 三、创建通知类
php artisan make:notification VerificationCode

> 生成的类按照下面的规则进行
class VerificationCode extends Notification
{
use Queueable;
private $code;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($code)
{
$this->code = $code;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [EasySmsChannel::class];
}
public function toEasySms($notifiable)
{
return (new EasySmsMessage())
->setTemplate('SMS_218023510')
->setData(['code' => $this->code]);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
#### 在 service 层中进行调用
Notification::route(
EasySmsChannel::class,
new \Overtrue\EasySms\PhoneNumber($mobile, 86) //86是国家区号
)->notify(new VerificationCode($code));