---
### 一、 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));