Passed
Pull Request — master (#673)
by
unknown
07:05
created

Audit::serializeDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace OwenIt\Auditing\Models;
4
5
use DateTimeInterface;
6
use Illuminate\Database\Eloquent\Model;
7
8
class Audit extends Model implements \OwenIt\Auditing\Contracts\Audit
9
{
10 1
    use \OwenIt\Auditing\Audit;
0 ignored issues
show
introduced by
The trait OwenIt\Auditing\Audit requires some properties which are not provided by OwenIt\Auditing\Models\Audit: $new_values, $url, $event, $auditable, $tags, $old_values, $user_agent, $ip_address, $user
Loading history...
11
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected $guarded = [];
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    protected $casts = [
21
        'old_values'   => 'json',
22
        'new_values'   => 'json',
23
        // Note: Please do not add 'auditable_id' in here, as it will break non-integer PK models
24
    ];
25
26 32
    protected function serializeDate(DateTimeInterface $date)
27
    {
28 32
        return $date->format('Y-m-d H:i:s');
29
    }
30
}
31