PHP code example of phattarachai / mail-log-laravel
1. Go to this page and download the library: Download phattarachai/mail-log-laravel 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/ */
phattarachai / mail-log-laravel example snippets
use Phattarachai\MailLogLaravel\MailLog;
use Phattarachai\MailLogLaravel\Models\MailLogGroup;
MailLogGroup::registerMorphMap();
MailLog::auth(fn ($request) => $request->user()?->isAdmin() ?? false);
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Headers;
use Phattarachai\MailLogLaravel\Concerns\HasMailLog;
class OrderShippedMail extends Mailable
{
use HasMailLog;
public function __construct(public Order $order) {}
protected function mailLogModel(): ?\Illuminate\Database\Eloquent\Model
{
return $this->order;
}
public function headers(): Headers
{
return $this->withMailLog(new Headers());
}
}