File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -167,4 +167,37 @@ public function attributesToArray()
167
167
168
168
return $ attributes ;
169
169
}
170
+
171
+ /**
172
+ * Get the model's original attribute values.
173
+ *
174
+ * @param string $key
175
+ * @param mixed $default
176
+ * @return array
177
+ */
178
+ public function getOriginal ($ key = null , $ default = null )
179
+ {
180
+ $ original = parent ::getOriginal ($ key , $ default );
181
+
182
+ if (!isset ($ this ->encryptable ))
183
+ {
184
+ return $ original ;
185
+ }
186
+
187
+ foreach ($ this ->encryptable as $ key )
188
+ {
189
+ if ( ! isset ($ original [$ key ])) continue ;
190
+
191
+ try
192
+ {
193
+ $ original [$ key ] = Crypt::decrypt ($ original [$ key ]);
194
+ }
195
+ catch (DecryptException $ exception )
196
+ {
197
+ //Do nothing, attribute already exists
198
+ }
199
+ }
200
+
201
+ return $ original ;
202
+ }
170
203
}
You can’t perform that action at this time.
0 commit comments