From 3a2423241361a3edcff8ea34e8e2163ecace3ccf Mon Sep 17 00:00:00 2001 From: fthvgb1 Date: Tue, 30 Jan 2018 01:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=88=97=E9=98=9F=EF=BC=8C=E5=8F=91?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Topic.php | 2 +- app/Notifications/TopicReplied.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Models/Topic.php b/app/Models/Topic.php index a126e1e..a3d6d3c 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -7,7 +7,7 @@ class Topic extends Model protected $fillable = ['title', 'category_id', 'body', 'excerpt', 'slug']; - public function link(...$params) + public function link($params) { return route('topics.show', array_merge([$this->id, $this->slug], $params)); } diff --git a/app/Notifications/TopicReplied.php b/app/Notifications/TopicReplied.php index 75701f7..ae41dd5 100644 --- a/app/Notifications/TopicReplied.php +++ b/app/Notifications/TopicReplied.php @@ -4,10 +4,11 @@ namespace App\Notifications; use App\Models\Reply; use Illuminate\Bus\Queueable; +use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -class TopicReplied extends Notification +class TopicReplied extends Notification implements ShouldQueue { use Queueable; @@ -31,7 +32,7 @@ class TopicReplied extends Notification */ public function via($notifiable) { - return ['database']; + return ['database', 'mail']; } /** @@ -42,9 +43,10 @@ class TopicReplied extends Notification */ public function toMail($notifiable) { + $url = $this->replay->topic->link(['#reply' . $this->replay->id]); return (new MailMessage) - ->line('The introduction to the notification.') - ->action('Notification Action', url('/')) + ->line('你的话题有新回复.') + ->action('N查看回复', $url) ->line('Thank you for using our application!'); } @@ -52,7 +54,7 @@ class TopicReplied extends Notification { $topic = $this->replay->topic; - $link = $topic->link('#reply', $this->replay->id); + $link = $topic->link(['#reply' . $this->replay->id]); return [ 'reply_id' => $this->replay->id,