@@ -34,6 +34,11 @@ final class MonitoredSecurityGroupNotificationEmail extends Mailable
3434 */
3535 public $ action ;
3636
37+ /**
38+ * @var string
39+ */
40+ public $ action_by ;
41+
3742 /**
3843 * @var int
3944 */
@@ -76,9 +81,17 @@ final class MonitoredSecurityGroupNotificationEmail extends Mailable
7681 */
7782 public $ subject ;
7883
84+ /**
85+ * @var string
86+ */
87+ public $ env ;
88+
89+ public $ action_by_phrase ;
90+
7991 /**
8092 * @param string $email
8193 * @param string $action
94+ * @param string $action_by
8295 * @param int $user_id
8396 * @param string $user_email
8497 * @param string $user_name
@@ -90,6 +103,7 @@ public function __construct
90103 (
91104 string $ email ,
92105 string $ action ,
106+ string $ action_by ,
93107 int $ user_id ,
94108 string $ user_email ,
95109 string $ user_name ,
@@ -100,20 +114,23 @@ public function __construct
100114 {
101115 $ this ->email = $ email ;
102116 $ this ->action = $ action ;
117+ $ this ->action_by = $ action_by ;
103118 $ this ->user_id = $ user_id ;
104119 $ this ->user_email = $ user_email ;
105120 $ this ->user_name = $ user_name ;
106121 $ this ->group_id = $ group_id ;
107122 $ this ->group_name = $ group_name ;
108123 $ this ->group_slug = $ group_slug ;
109-
124+ $ this ->env = Config::get ('app.env ' );
125+ $ this ->action_by_phrase = $ this ->action_by ? " by $ this ->action_by " : "" ;
110126 Log::debug
111127 (
112128 sprintf
113129 (
114- "MonitoredSecurityGroupNotificationEmail::constructor email %s action %s user_id %s user_email %s user_name %s group_id %s group_name %s group_slug %s " ,
130+ "MonitoredSecurityGroupNotificationEmail::constructor email %s action %s action_by %s user_id %s user_email %s user_name %s group_id %s group_name %s group_slug %s " ,
115131 $ email ,
116132 $ action ,
133+ $ action_by ,
117134 $ user_id ,
118135 $ user_email ,
119136 $ user_name ,
@@ -126,15 +143,19 @@ public function __construct
126143
127144 public function build ()
128145 {
146+
147+
129148 $ this ->subject = sprintf
130149 (
131- "[%s] Monitored Security Groups - User %s (%s) has been %s - Group %s (%s) "
150+ "[%s] Monitored Security Groups - User %s (%s) has been %s%s - Group %s (%s) - Environment: %s "
132151 ,Config::get ('app.app_name ' )
133152 ,$ this ->user_name
134153 ,$ this ->user_email
135154 ,$ this ->action
155+ ,$ this ->action_by_phrase
136156 ,$ this ->group_name
137157 ,$ this ->group_id
158+ ,$ this ->env
138159 );
139160 Log::debug (sprintf ("MonitoredSecurityGroupNotificationEmail::build to %s " , $ this ->email ));
140161 return $ this ->from (Config::get ("mail.from " ))
0 commit comments