1. Go to this page and download the library: Download synergitech/laravel-postal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
synergitech / laravel-postal example snippets
use App\Notifications\EnquiryNotification;
use Illuminate\Support\Facades\Notification;
use SynergiTech\Postal\PostalNotificationChannel;
// Using the Notifiable trait
$user->notify(new EnquiryNotification($enquiry));
// On demand notifications
Notification::route(PostalNotificationChannel::class, '[email protected]')
->notify(new EnquiryNotification($enquiry));
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use SynergiTech\Postal\PostalNotificationChannel;
class EnquiryNotification extends Notification
{
private $enquiry;
public function __construct($enquiry)
{
$this->enquiry = $enquiry;
}
public function via($notifiable)
{
return [PostalNotificationChannel::class];
}
public function logEmailAgainstModel()
{
return $this->enquiry;
}
public function toMail($notifiable)
{
// message constructed here
}
}