CasperSecurity
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class LeadCreatedNotification extends Notification
{
use Queueable;
public $data;
public function __construct($data)
{
$this->data = $data;
}
// Define which channels the notification should be sent through
public function via($notifiable)
{
return ['mail', 'database']; // Mail and database channels
}
// Email Notification
public function toMail($notifiable)
{
return (new MailMessage)
->subject('New Lead Created')
->line('A new lead has been created.')
->action('View Lead', url('/client_manage_lead'));
}
// Database Notification
public function toDatabase($notifiable)
{
return [
'message' => 'A new lead has been created.',
'url' => url('/client_manage_lead'),
];
}
}