22
33namespace Backstage \Filament \Users \Pages \Auth ;
44
5- use Filament \Pages \Auth \EditProfile as BaseEditProfile ;
6- use Filament \Forms \Components \Select ;
7- use Backstage \Filament \Users \Models \User ;
8- use Backstage \Laravel \Users \Eloquent \Models \UserNotificationPreference ;
95use Backstage \Laravel \Users \Enums \NotificationType ;
6+ use Filament \Forms \Components \Select ;
7+ use Filament \Pages \Auth \EditProfile as BaseEditProfile ;
108
119class EditProfile extends BaseEditProfile
1210{
@@ -37,14 +35,14 @@ public static function getNotificationFormComponent(): Select
3735 $ options = [];
3836
3937 foreach ($ types as $ type ) {
40- $ options [$ type ->value ] = $ type ->label ();
38+ $ options [$ type ->value ] = $ type ->label ();
4139 }
4240
4341 return Select::make ('notification_preferences ' )
4442 ->label (__ ('Notification preferences ' ))
45- ->options (fn () => $ options )
43+ ->options (fn () => $ options )
4644 ->live ()
47- ->placeholder (fn () => ('Select notification preferences ' ))
45+ ->placeholder (fn () => ('Select notification preferences ' ))
4846 ->searchingMessage (__ ('Searching notification types... ' ))
4947 ->searchPrompt (__ ('Search notification types... ' ))
5048 ->preload ()
@@ -57,12 +55,12 @@ public function saveNotificationPreferences()
5755
5856 $ state = $ formState ['notification_preferences ' ];
5957
60- $ state = collect ($ state )->map (fn ($ value ) => NotificationType::from ($ value ));
58+ $ state = collect ($ state )->map (fn ($ value ) => NotificationType::from ($ value ));
6159
6260 $ record = $ this ->getUser ();
6361
6462 $ state ->each (function (NotificationType $ type ) use ($ record ) {
65- if (!$ record ->notificationPreferences ->contains ('navigation_type ' , $ type ->value )) {
63+ if (! $ record ->notificationPreferences ->contains ('navigation_type ' , $ type ->value )) {
6664
6765 $ record ->notificationPreferences ()->create ([
6866 'navigation_type ' => $ type ->value ,
@@ -78,7 +76,7 @@ protected function mutateFormDataBeforeFill(array $data): array
7876 $ user = $ this ->getUser ();
7977
8078 if ($ user ->notificationPreferences ->isNotEmpty ()) {
81- $ data ['notification_preferences ' ] = $ user ->notificationPreferences ->pluck ('navigation_type ' )->map (fn (NotificationType $ record ) => $ record ->value )->toArray ();
79+ $ data ['notification_preferences ' ] = $ user ->notificationPreferences ->pluck ('navigation_type ' )->map (fn (NotificationType $ record ) => $ record ->value )->toArray ();
8280 }
8381
8482 return $ data ;
0 commit comments