File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,12 +52,6 @@ class BetterEmail extends Model
5252
5353 protected $ table = 'mails ' ;
5454
55- public function __construct (array $ attributes = [])
56- {
57- parent ::__construct ($ attributes );
58- $ this ->table = config ('filament-better-mails.mails.database.tables.mails ' ) ?: parent ::getTable ();
59- }
60-
6155 protected $ fillable = [
6256 'uuid ' ,
6357 'mailer ' ,
@@ -120,6 +114,12 @@ public function __construct(array $attributes = [])
120114 'updated_at ' => 'datetime ' ,
121115 ];
122116
117+ public function __construct (array $ attributes = [])
118+ {
119+ parent ::__construct ($ attributes );
120+ $ this ->table = config ('filament-better-mails.mails.database.tables.mails ' ) ?: parent ::getTable ();
121+ }
122+
123123 public function prunable (): Builder
124124 {
125125 $ pruneAfter = config ('filament-better-mails.mails.database.pruning.after ' , 30 );
Original file line number Diff line number Diff line change @@ -25,12 +25,6 @@ class BetterEmailAttachment extends Model
2525 */
2626 protected $ table = 'mail_attachments ' ;
2727
28- public function __construct (array $ attributes = [])
29- {
30- parent ::__construct ($ attributes );
31- $ this ->table = config ('filament-better-mails.mails.database.tables.attachments ' ) ?: parent ::getTable ();
32- }
33-
3428 protected $ fillable = [
3529 'disk ' ,
3630 'uuid ' ,
@@ -49,6 +43,12 @@ public function __construct(array $attributes = [])
4943 'size ' => 'integer ' ,
5044 ];
5145
46+ public function __construct (array $ attributes = [])
47+ {
48+ parent ::__construct ($ attributes );
49+ $ this ->table = config ('filament-better-mails.mails.database.tables.attachments ' ) ?: parent ::getTable ();
50+ }
51+
5252 public function mail (): BelongsTo
5353 {
5454 return $ this ->belongsTo (config ('filament-better-mails.mails.models.mail ' ));
Original file line number Diff line number Diff line change @@ -34,12 +34,6 @@ class BetterEmailEvent extends Model
3434
3535 protected $ table = 'mail_events ' ;
3636
37- public function __construct (array $ attributes = [])
38- {
39- parent ::__construct ($ attributes );
40- $ this ->table = config ('filament-better-mails.mails.database.tables.events ' ) ?: parent ::getTable ();
41- }
42-
4337 protected $ fillable = [
4438 'mail_id ' ,
4539 'type ' ,
@@ -67,6 +61,12 @@ public function __construct(array $attributes = [])
6761 'unsuppressed_at ' => 'datetime ' ,
6862 ];
6963
64+ public function __construct (array $ attributes = [])
65+ {
66+ parent ::__construct ($ attributes );
67+ $ this ->table = config ('filament-better-mails.mails.database.tables.events ' ) ?: parent ::getTable ();
68+ }
69+
7070 /**
7171 * @return BelongsTo<BetterEmail, $this>
7272 */
Original file line number Diff line number Diff line change @@ -60,6 +60,18 @@ public function boot(): void
6060 $ this ->loadRoutesFrom (__DIR__ .'/../routes/filament-better-mails-route.php ' );
6161 }
6262
63+ protected function getMigrationFileName (string $ migrationFileName ): string
64+ {
65+ $ timestamp = date ('Y_m_d_His ' );
66+
67+ $ filesystem = $ this ->app ->make (Filesystem::class);
68+
69+ return Collection::make ([$ this ->app ->databasePath ().DIRECTORY_SEPARATOR .'migrations ' .DIRECTORY_SEPARATOR ])
70+ ->flatMap (fn ($ path ) => $ filesystem ->glob ($ path .'*_ ' .$ migrationFileName ))
71+ ->push ($ this ->app ->databasePath ()."/migrations/ {$ timestamp }_ {$ migrationFileName }" )
72+ ->first ();
73+ }
74+
6375 private function loadListeners (): void
6476 {
6577 Event::listen (MessageSending::class, BeforeSendingMailListener::class);
@@ -112,16 +124,4 @@ private function publish(): void
112124 __DIR__ .'/../resources/views ' => resource_path ('views ' ),
113125 ], 'filament-better-mails-views ' );
114126 }
115-
116- protected function getMigrationFileName (string $ migrationFileName ): string
117- {
118- $ timestamp = date ('Y_m_d_His ' );
119-
120- $ filesystem = $ this ->app ->make (Filesystem::class);
121-
122- return Collection::make ([$ this ->app ->databasePath ().DIRECTORY_SEPARATOR .'migrations ' .DIRECTORY_SEPARATOR ])
123- ->flatMap (fn ($ path ) => $ filesystem ->glob ($ path .'*_ ' .$ migrationFileName ))
124- ->push ($ this ->app ->databasePath ()."/migrations/ {$ timestamp }_ {$ migrationFileName }" )
125- ->first ();
126- }
127127}
You can’t perform that action at this time.
0 commit comments