66 lines
1.4 KiB
PHP
66 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Channels\WeChatChannel;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
abstract class BaseNotification extends Notification implements ShouldQueue
|
|
{
|
|
|
|
/**
|
|
* 队列驱动链接
|
|
* @var string|null
|
|
*/
|
|
public $connection = 'database';
|
|
|
|
/**
|
|
* 任务队列
|
|
* @var string|null
|
|
*/
|
|
public $queue = 'NOTIFY';
|
|
|
|
/**
|
|
* 延迟时间
|
|
* @var \DateTimeInterface|\DateInterval|int|null
|
|
*/
|
|
public $delay;
|
|
|
|
/**
|
|
* 获取通知类型
|
|
* @Author:<C.Jason>
|
|
* @Date:2018-11-05T11:43:53+0800
|
|
* @return [type] [description]
|
|
*/
|
|
abstract public static function title();
|
|
|
|
/**
|
|
* 通知默认发送通道
|
|
* @Author:<C.Jason>
|
|
* @Date:2018-11-05T11:44:03+0800
|
|
* @param App\User $notifiable 通知对象
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return ['database', WeChatChannel::class];
|
|
}
|
|
|
|
/**
|
|
* 格式化至数据库
|
|
* @Author:<C.Jason>
|
|
* @Date:2018-11-05T11:44:51+0800
|
|
* @param App\User $notifiable 通知对象
|
|
*/
|
|
abstract public function toArray($notifiable);
|
|
|
|
/**
|
|
* 通知到微信的实际方法
|
|
* @Author:<C.Jason>
|
|
* @Date:2018-11-12T16:35:44+0800
|
|
* @param App\User $notifiable 通知对象
|
|
*/
|
|
abstract public function toWechat($notifiable);
|
|
}
|