Avoid email log

My app send 2 kind of email automatic (for example when an item is created) or manual, from admin to user i have setup a listener that fires when i send an email (any kind of email) then i have a function that create a log
public function handle(object $event): void
{
if(isset($event->data['repairId'])){
$Log = $this->createRepairLog($event->data['subject'], 1, 'EmailSent', $event->data['repairId'], '', auth()->id());
}
}
public function handle(object $event): void
{
if(isset($event->data['repairId'])){
$Log = $this->createRepairLog($event->data['subject'], 1, 'EmailSent', $event->data['repairId'], '', auth()->id());
}
}
the second parameters of createRepairLog can be 1 or 0 for example when a repair is created, 2 email are sent 1 at customer (1) and 1 at assignee technician (0) how can i differentiate this two emails to create the proper log?
3 Replies
Lara Zeus
Lara Zeus12mo ago
I think the $event can hold the email class name that been used?!! dd the $event and see what data you have
Soundmit
SoundmitOP12mo ago
Soundmit
SoundmitOP12mo ago
uhm, i use the same email class for all the message... there is no class reference in $event ok, solved by using 2 template
Want results from more Discord servers?
Add your server