Skip to content

Commit 230cf53

Browse files
committed
Cast dos valores new e old
1 parent 4301d66 commit 230cf53

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/OwenIt/Auditing/Log.php

+27
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@
66

77
class Log extends Model
88
{
9+
/**
10+
* @var string
11+
*/
912
public $table = 'logs';
1013

14+
/**
15+
* Cast values
16+
* @var array
17+
*/
18+
protected $casts = ['old_value' => 'json', 'new_value' => 'json'];
19+
1120
/**
1221
* Auditing.
1322
*
@@ -32,4 +41,22 @@ public function historyOf()
3241
}
3342
return false;
3443
}
44+
45+
/**
46+
* Get old value
47+
* @return mixed
48+
*/
49+
public function getOldAttribute()
50+
{
51+
return $this->old_value;
52+
}
53+
54+
/**
55+
* Get new value
56+
* @return mixed
57+
*/
58+
public function getNewAttribute()
59+
{
60+
return $this->new_value;
61+
}
3562
}

0 commit comments

Comments
 (0)