RickDBCN / filament-email

Log emails in your Filament project
https://filament-email-demo.marcogermani.it/
MIT License
77 stars 23 forks source link

Add the ability to set the FilamentEmailLogger class in the config #39

Closed john-aspire closed 5 months ago

john-aspire commented 6 months ago

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!

RickDBCN commented 6 months ago

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.

john-aspire commented 6 months ago

Hi Rick,

Thanks for your fast response.

I am fairly new to the Laravel/Filament eco system, so perhaps there's a more established way to do it.

Upon a google search I see options such as "AliasLoader", perhaps that's what you're suggesting?

I guess my only point would be that as you have a config file that does similar with other classes, it would be an intuitive and consistent place for me to configure the service.

Thanks again for your efforts.

Regards,

John


From: Rick de Boer @.> Sent: Tuesday, February 27, 2024 8:46 PM To: RickDBCN/filament-email @.> Cc: john-aspire @.>; Author @.> Subject: Re: [RickDBCN/filament-email] Add the ability to set the FilamentEmailLogger class in the config (Issue #39)

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.

— Reply to this email directly, view it on GitHubhttps://github.com/RickDBCN/filament-email/issues/39#issuecomment-1966587023, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD76NDJPTV4XEEL22TPOU63YVXPVFAVCNFSM6AAAAABD3F75HGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRWGU4DOMBSGM. You are receiving this because you authored the thread.Message ID: @.***>

RickDBCN commented 5 months ago

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