AuthenticationLog::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace serwin35\AuthenticationLog;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class AuthenticationLog extends Model
8
{
9
    /**
10
     * The table associated with the model.
11
     *
12
     * @var string
13
     */
14
    public function __construct(array $attributes = [])
15
    {
16
        parent::__construct($attributes);
17
        $this->table = config('authentication-log.table_name');
18
    }
19
20
    /**
21
     * Indicates if the model should be timestamped.
22
     *
23
     * @var bool
24
     */
25
    public $timestamps = false;
26
27
    /**
28
     * The attributes that aren't mass assignable.
29
     *
30
     * @var array
31
     */
32
    protected $guarded = ['auth_id', 'auth_type'];
33
34
    /**
35
     * The attributes that should be cast to native types.
36
     *
37
     * @var array
38
     */
39
    protected $casts = [
40
        'login_at' => 'datetime',
41
        'logout_at' => 'datetime',
42
    ];
43
44
    /**
45
     * Get the authenticatable entity that the authentication log belongs to.
46
     */
47
    public function authenticatable()
48
    {
49
        return $this->morphTo();
50
    }
51
}
52