tomirons / tuxedo

Simple transactional email classes/templates for Laravel 5 mailables
MIT License
94 stars 5 forks source link

would be nice to have a config file where you can change the namespace of the classes #19

Closed vesper8 closed 7 years ago

vesper8 commented 7 years ago

Would also be nice to have the option to publish the 3 mail classes so we can override them

I have a situation where I need to pass custom headers to Mail::queue and I am implementing the fix here https://medium.com/@guysmilez/queuing-mailables-with-custom-headers-in-laravel-5-4-ab615f022f17

But in order to do that I have to extend Mailable, but your classes also extend Mailable and I want to use your classes.. so now I have to copy your classes to my own codebase and change them so they extend my modified Mailable class :)

Dylan-DPC-zz commented 7 years ago

@vesper8 you can extend the mail classes of the package if that works in this case

vesper8 commented 7 years ago

right.. yes that's what I did. But I needed to change which class the package's classes extend. Instead of extending Mailable directly I needed to have them extend something else that itself extends Mailable. So I had to copy your classes to my own codebase so I could change which class they extend. I did all that and it is working.

Thanks

Lloople commented 7 years ago

@vesper8 what dylan is saying is that you can extend his class without copying or modifying the namespace:

use TomIrons\Mailables\ActionMailable;

class MyActionMailable extends ActionMailable
{
    // ... override some methods

}
tomirons commented 7 years ago

I'm on the same page as @Lloople, you can still access everything inside the Mailable class through the classes in this package.