<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
henryavila / laravel-nova-email-tracking example snippets
return [
/**
* if defined, the Email model will use this database connection.
* This connection name must be defined in database.connections config file
*/
'email-db-connection' => null,
/**
* Save the HTML Body of all sent messages
*/
'log-body-html' => true,
/**
* Save the TXT Body of all sent messages
*/
'log-body-txt' => true,
];
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
\HenryAvila\LaravelNovaEmailTracking\Nova\LaravelNovaEmailTrackingTool::make()
}
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
\HenryAvila\LaravelNovaEmailTracking\Nova\LaravelNovaEmailTrackingTool::make()
->emailResource(CustomEmailResource::class)
}
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
\Illuminate\Mail\Events\MessageSent::class => [
\HenryAvila\LaravelNovaEmailTracking\Listeners\LogEmailSentListener::class,
],
];
class SampleMail extends \Illuminate\Mail\Mailable
{
public function __construct()
{
//
}
public function content(): Content
{
return new Content(
view: 'view.name',
);
}
}
class SampleMail extends \HenryAvila\LaravelNovaEmailTracking\Mail\TrackableMail
{
public function __construct($modelSender)
{
$viewData = [];
parent::__construct($modelSender, 'view.name', $viewData]);
}
}
// example: Send the Sample Mail to User with id 1
$user = User::find(1);
Mail::to($user)->send(new App\Mail\SampleMail($user));
public function toMail($notifiable): MailMessage
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
public function __construct(public \Illuminate\Database\Eloquent\Model $model)
{
//
}
public function toMail($notifiable): MailMessage
{
return (new \HenryAvila\LaravelNovaEmailTracking\Notifications\TrackableNotificationMailMessage($this->model))
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
// User with id 1 send the sample notification to multiple $clientes
$user = User::find(1);
Notification::send($clientes, new SampleNotification($user));
public function fields(Request $request)
{
return [
...
\HenryAvila\LaravelNovaEmailTracking\LaravelNovaEmailTracking::hasManyEmailsField(),
...
];
}