RickDBCN/filament-email

Add the ability to set the FilamentEmailLogger class in the config

john-aspire opened this issue · 3 comments

Is your feature request related to a problem? Please describe.
I would like to add extra fields when logging to the database, such as the currently logged on user, etc.

Describe the solution you'd like
If I could set the FilamentEmailLogger class in the config, (the same as you've done with EmailResource), then I could add the fields required.

Describe alternatives you've considered
Alternatively you could modify your Email class to look for specific session variables, either fixed or dynamic. Eg. you could:

public function handle(object $event): void
$model::create([
...
'foreign_id' => session("filament_email_foreign_id")

You could also have an array of fields to populate in the config file?

Additional context
Thank you, for your time!

I'm not entirely sure whether or not this should become a config option. Aren't you able to override the FilamentEmailLogger class and extend it with your own logic, for example the fields you want populated?
I feel like saving this data is opinionated and only for specific use cases.

Yeah, I guess the best way is to extend the class and change it yourself.