Laravel web pu sh уведомления - PullRequest
       8

Laravel web pu sh уведомления

0 голосов
/ 23 января 2020

У меня есть система регистрации пользователей. Я хочу отправить веб-уведомление указанному c пользователю, когда администратор подтвердит, что учетная запись пользователя. Электронная почта уже отправлена ​​пользователям. Я пытался использовать этот pusher.data, также вставленный в таблицу уведомлений. Но всегда значение notifiable_id отображается как «1». снимок экрана

это код для класса уведомлений

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class UserRegistrationCompleteNotification extends Notification
{
    use Queueable;
    private $details;
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($details,$email)
    {
        $this->details= $details;
        $this->email = $email;
    }
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail','database'];
    }
    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        $notifiable->email = $this->email;
        return (new MailMessage)
            ->greeting($this->details['greeting'])
            ->subject('【M&A】 会員登録のご案内')
            ->line($this->details['body1'])
            ->line($this->details['body2'])
            ->line($this->details['body3'])
            ->line($this->details['body4'])
            ->line($this->details['body5'])
            ->line($this->details['body6'])
            ->line($this->details['body7'])
            ->line($this->details['body8'])
            ->line($this->details['body9'])
            ->line($this->details['body10'])
            ->line($this->details['thanks']);
    }
    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
    public function toDatabase($notifiable)
    {
        return [
        ];
    }
}

...