File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
app/Filament/Pages/Settings Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -100,8 +100,7 @@ protected function getFormSchema(): array
100100 ->label ('Recipients ' )
101101 ->schema ([
102102 TextInput::make ('email_address ' )
103- ->email ()
104- ->required (fn (Closure $ get ) => $ get ('mail_enabled ' ) == true ),
103+ ->email (),
105104 ])
106105 ->hidden (fn (Closure $ get ) => $ get ('mail_enabled ' ) !== true )
107106 ->columnSpan (['md ' => 2 ]),
@@ -152,14 +151,21 @@ public function sendTestMailNotification()
152151 {
153152 $ notificationSettings = new (NotificationSettings::class);
154153
155- foreach ($ notificationSettings ->mail_recipients as $ recipient ) {
156- Mail::to ($ recipient )
157- ->send (new Test ());
158- }
154+ if (count ($ notificationSettings ->mail_recipients )) {
155+ foreach ($ notificationSettings ->mail_recipients as $ recipient ) {
156+ Mail::to ($ recipient )
157+ ->send (new Test ());
158+ }
159159
160- Notification::make ()
161- ->title ('Test mail notification sent. ' )
162- ->success ()
163- ->send ();
160+ Notification::make ()
161+ ->title ('Test mail notification sent. ' )
162+ ->success ()
163+ ->send ();
164+ } else {
165+ Notification::make ()
166+ ->title ('You need to add recipients to receive mail notifications. ' )
167+ ->warning ()
168+ ->send ();
169+ }
164170 }
165171}
You can’t perform that action at this time.
0 commit comments