RickDBCN / filament-email

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

Option to override the default Mail model class #30

Closed Jacobtims closed 8 months ago

Jacobtims commented 10 months ago

I want to override the default Mail model class because I use tenancy in my application. I would like to have a similar option in the config, as the override for the Filament EmailResource class. Something like this:

<?php

// config for RickDBCN/FilamentEmail
return [
    'resource' => [
        'class' => \App\Filament\Resources\EmailResource::class,
        'model' => \App\Models\Email::class,
    ],
];

I now need to force override it in my AppServiceProvider register() method, which is not a nice way:

$loader = AliasLoader::getInstance();
$loader->alias(\RickDBCN\FilamentEmail\Models\Email::class, \App\Models\Email::class);
RickDBCN commented 10 months ago

Hi Jacob,

Great idea! I'll probably get this sorted next week.

If you can find time to PR this in the mean time, that would be highly appreciated. Otherwise I'll do it somewhere next week.