TODO WeCom As Channel
This commit is contained in:
parent
e6fc281ec1
commit
997b58cda3
@ -17,7 +17,7 @@ public function __construct($servers)
|
|||||||
$this->data = $servers;
|
$this->data = $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function broadcastOn()
|
public function broadcastOn(): Channel
|
||||||
{
|
{
|
||||||
return new Channel('servers');
|
return new Channel('servers');
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ public function __construct($user_id, $type, $message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function broadcastOn()
|
public function broadcastOn(): PrivateChannel
|
||||||
{
|
{
|
||||||
return new PrivateChannel('users.' . $this->user_id);
|
return new PrivateChannel('users.' . $this->user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function broadcastAs()
|
public function broadcastAs(): string
|
||||||
{
|
{
|
||||||
return 'user';
|
return 'user';
|
||||||
}
|
}
|
||||||
|
61
app/Notifications/WeComChannel.php
Normal file
61
app/Notifications/WeComChannel.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class WeComChannel extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return (new MailMessage)
|
||||||
|
->line('The introduction to the notification.')
|
||||||
|
->action('Notification Action', url('/'))
|
||||||
|
->line('Thank you for using our application!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user