Passed
Branch master (cd4548)
by Fèvre
19:36
created

UserLog   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 50
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A loggable() 0 3 1
1
<?php
2
namespace Xetaravel\Models;
3
4
class UserLog extends Model
5
{
6
    /**
7
     * The table associated with the model.
8
     *
9
     * @var string
10
     */
11
    protected $table = 'user_log';
12
13
    /**
14
     * The attributes that are mass assignable.
15
     *
16
     * @var array
17
     */
18
    protected $fillable = [
19
        'user_id',
20
        'steam_id',
21
        'loggable_id',
22
        'loggable_type',
23
        'event_type',
24
        'data'
25
    ];
26
27
    /**
28
     * The attributes that should be cast to native types.
29
     *
30
     * @var array
31
     */
32
    protected $casts = [
33
        'data' => 'array'
34
    ];
35
36
    /**
37
     * Get the user that owns the log.
38
     *
39
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
40
     */
41
    public function user()
42
    {
43
        return $this->belongsTo(User::class);
44
    }
45
46
    /**
47
     * Get the loggable relation.
48
     *
49
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
50
     */
51
    public function loggable()
52
    {
53
        return $this->morphTo();
54
    }
55
}
56