-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Notification Email instead of Email.(Optional)
- Loading branch information
1 parent
f85b0db
commit 8d89d2c
Showing
2 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class NewPostNotify extends Notification implements ShouldQueue | ||
{ | ||
use Queueable; | ||
public $post; | ||
|
||
/** | ||
* Create a new notification instance. | ||
*/ | ||
public function __construct($post) | ||
{ | ||
$this->post = $post; | ||
} | ||
|
||
/** | ||
* 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()) | ||
->subject('New Post Availabel') | ||
->greeting('Hello Subscriber !') | ||
->line('There is a new Post. Hope you will Like it :)') | ||
->line('Post Title : '.$this->post->title) | ||
->line('Author : '.$this->post->user->name) | ||
->action('View Post', url(route('post', $this->post->slug))) | ||
->line('Thank you.'); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return [ | ||
]; | ||
} | ||
} |