| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class NewFileUploaded extends Notification |
||
| 11 | { |
||
| 12 | use Queueable; |
||
| 13 | |||
| 14 | protected $details; |
||
| 15 | |||
| 16 | // constructor receives the file link details |
||
| 17 | public function __construct($details) |
||
| 18 | { |
||
| 19 | $this->details = $details; |
||
| 20 | } |
||
| 21 | |||
| 22 | // Notification is sent via email and dashboard notification |
||
| 23 | public function via($notifiable) |
||
| 26 | } |
||
| 27 | |||
| 28 | // Email to link owner |
||
| 29 | public function toMail($notifiable) |
||
| 30 | { |
||
| 31 | return (new MailMessage) |
||
| 32 | ->line('A new file has been uploaded to the file link - '.$this->details->link_name) |
||
| 33 | ->action('Click to View Link', |
||
| 34 | url(route('links.info', [ |
||
| 35 | 'id' => $this->details->link_id, |
||
| 36 | 'name' => urlencode($this->details->link_name) |
||
| 37 | ]))); |
||
| 38 | } |
||
| 39 | |||
| 40 | // Dashboard notification |
||
| 41 | public function toArray($notifiable) |
||
| 49 | ])) |
||
| 50 | ]; |
||
| 51 | } |
||
| 53 |