AuthenticationLog::authenticatable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Yadahan\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
    protected $table = 'authentication_log';
15
16
    /**
17
     * Indicates if the model should be timestamped.
18
     *
19
     * @var bool
20
     */
21
    public $timestamps = false;
22
23
    /**
24
     * The attributes that aren't mass assignable.
25
     *
26
     * @var array
27
     */
28
    protected $guarded = ['authenticatable_id', 'authenticatable_type'];
29
30
    /**
31
     * The attributes that should be cast to native types.
32
     *
33
     * @var array
34
     */
35
    protected $casts = [
36
        'login_at' => 'datetime',
37
        'logout_at' => 'datetime',
38
    ];
39
40
    /**
41
     * Get the authenticatable entity that the authentication log belongs to.
42
     */
43
    public function authenticatable()
44
    {
45
        return $this->morphTo();
46
    }
47
}
48