@@ -207,15 +207,21 @@ class Post extends Auditing
207207 public static $logCustomMessage = '{user.name|Anonymous} {type} a post {elapsed_time}'; // with default value
208208 public static $logCustomFields = [
209209 'title' => 'The title was defined as "{new.title||getNewTitle}"', // with callback method
210- 'ip' => [
211- 'updated' => 'The post has been updated from the ip address: {new.ip}.',
212- 'created' => 'The post was created from the ip address: {new.ip|Not registered}.'
210+ 'ip' => 'The changes were recorded from the address {ip|route|getAnotherthing}',
211+ 'publish_date' => [
212+ 'created' => 'Publication date: {new.publish_date}',
213+ 'updated' => 'The post publication date has been updated from {old.publish_date} to {new.publish_date}'
213214 ]
214215 ];
215216
216217 public function getNewTitle($log)
217218 {
218- return $log->new['title'];
219+ return $log->old['title'];
220+ }
221+
222+ public function getAnotherthing($log)
223+ {
224+ return ':(';
219225 }
220226
221227 //...
@@ -261,18 +267,20 @@ Result:
261267 <li >Antério Vieira created a post 1 day ago
262268 <ul>
263269 <li>The title was defined as "Did someone say rapid?"</li>
264- <li>The post was created from the ip address: 192.168.10.1</li>
270+ <li>The changes were recorded from the address 192.168.10.1</li>
271+ <li>Publication date: 2016-05-25 00:49:26.0</li>
265272 </ul>
266273 </li >
267274 <li >Antério Vieira updated a post 1 day ago
268275 <ul>
269276 <li>The title was updated as "Did someone say rapid?"</li>
270- <li>The post was updated from the ip address: 192.168.10.1</li>
277+ <li>The changes were recorded from the address 192.168.10.1</li>
278+ <li>The post publication date has been updated from 2016-05-20 00:49:26.0 to 2016-05-25 00:49:26.0</li>
271279 </ul>
272280 </li >
273281 <li >Raphael França deleted a post 2 day ago
274282 <ul>
275- <li>No details </li>
283+ <li>The changes were recorded from the address 192.168.10.1 </li>
276284 </ul>
277285 </li >
278286 <li >...</li >
0 commit comments