From f7e1bb464d66de53dfe8dc4bfc15d648159a1387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=A9rio=20vieira=20da=20silva?= Date: Mon, 19 Oct 2015 13:50:19 -0200 Subject: [PATCH] Updated documentation --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bf8c9796..1ef17402 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ $logs = Team::logs->with(['user'])->get(); ## Featuring Log -You it can set custom messages for presentation of logs. These messages can be set for both the model as for specific fields.The dynamic part of the message can be done by targeted fields per dot segmented as`{objeto.field} or {objeto.objeto.field}`. +You it can set custom messages for presentation of logs. These messages can be set for both the model as for specific fields.The dynamic part of the message can be done by targeted fields per dot segmented as`{objeto.value.value} or {object.value|Default value} or {object.value||callbackMethod}`. Set messages to the model ```php @@ -185,14 +185,19 @@ use OwenIt\Auditing\Auditing; class Team extends Auditing { //... - public static $logCustomMessage = '{user.name|Anonymous} {type} a team {elapsed_time}'; + public static $logCustomMessage = '{user.name|Anonymous} {type} a team {elapsed_time}'; // with default value public static $logCustomFields = [ - 'name' => 'The name was defined as {new.name}', + 'name' => 'The name was defined as {new.name||getNewName}', // with callback method 'owner' => [ 'updated' => '{new.owner} owns the team', 'created' => '{new.owner|No one} was defined as owner' ], ]; + + public function getNewName($log) + { + return $log->new['name']; + } //... } ```