-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Owen Melbourne
committed
Aug 19, 2019
1 parent
6a17ccc
commit 6d90db7
Showing
19 changed files
with
623 additions
and
40 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
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,81 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Website; | ||
use App\CertificateScan; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class CertificateHasExpired extends Notification | ||
{ | ||
use Queueable; | ||
|
||
/** | ||
* @var Website | ||
*/ | ||
private $website; | ||
|
||
/** | ||
* @var CertificateScan | ||
*/ | ||
private $scan; | ||
|
||
/** | ||
* Create a new notification instance. | ||
* | ||
* @param Website $website | ||
* @param CertificateScan $scan | ||
*/ | ||
public function __construct(Website $website, CertificateScan $scan) | ||
{ | ||
$this->website = $website; | ||
$this->scan = $scan; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable) | ||
{ | ||
return ['database', 'mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->subject('π SSL has expired on: ' . $this->website->url) | ||
->markdown('mail.ssl-expired', [ | ||
'website' => $this->website, | ||
'scan' => $this->scan, | ||
]); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return [ | ||
'website_id' => $this->website->id, | ||
'website' => $this->website->certificate_hostname, | ||
'was_valid' => $this->scan->was_valid, | ||
'did_expire' => $this->scan->did_expire, | ||
'grade' => $this->scan->grade, | ||
]; | ||
} | ||
} |
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,81 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Website; | ||
use App\CertificateScan; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class CertificateIsExpiring extends Notification | ||
{ | ||
use Queueable; | ||
|
||
/** | ||
* @var Website | ||
*/ | ||
private $website; | ||
|
||
/** | ||
* @var CertificateScan | ||
*/ | ||
private $scan; | ||
|
||
/** | ||
* Create a new notification instance. | ||
* | ||
* @param Website $website | ||
* @param CertificateScan $scan | ||
*/ | ||
public function __construct(Website $website, CertificateScan $scan) | ||
{ | ||
$this->website = $website; | ||
$this->scan = $scan; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable) | ||
{ | ||
return ['database', 'mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->subject('π SSL expires today on: ' . $this->website->url) | ||
->markdown('mail.ssl-expiring', [ | ||
'website' => $this->website, | ||
'scan' => $this->scan, | ||
]); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return [ | ||
'website_id' => $this->website->id, | ||
'website' => $this->website->certificate_hostname, | ||
'was_valid' => $this->scan->was_valid, | ||
'did_expire' => $this->scan->did_expire, | ||
'grade' => $this->scan->grade, | ||
]; | ||
} | ||
} |
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,81 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Website; | ||
use App\CertificateScan; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class CertificateIsInvalid extends Notification | ||
{ | ||
use Queueable; | ||
|
||
/** | ||
* @var Website | ||
*/ | ||
private $website; | ||
|
||
/** | ||
* @var CertificateScan | ||
*/ | ||
private $scan; | ||
|
||
/** | ||
* Create a new notification instance. | ||
* | ||
* @param Website $website | ||
* @param CertificateScan $scan | ||
*/ | ||
public function __construct(Website $website, CertificateScan $scan) | ||
{ | ||
$this->website = $website; | ||
$this->scan = $scan; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable) | ||
{ | ||
return ['database', 'mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->subject('π SSL is invalid on: ' . $this->website->url) | ||
->markdown('mail.ssl-invalid', [ | ||
'website' => $this->website, | ||
'scan' => $this->scan, | ||
]); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return [ | ||
'website_id' => $this->website->id, | ||
'website' => $this->website->certificate_hostname, | ||
'was_valid' => $this->scan->was_valid, | ||
'did_expire' => $this->scan->did_expire, | ||
'grade' => $this->scan->grade, | ||
]; | ||
} | ||
} |
Oops, something went wrong.