Visit::visitable()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Hayrullah\LaravelVisits\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
use Illuminate\Support\Facades\Config;
8
9
/**
10
 * This file is part of Laravel Favorite,.
11
 *
12
 * @license MIT
13
 */
14
class Visit extends Model
15
{
16
    /**
17
     * The table associated with the model.
18
     *
19
     * @var string
20
     */
21
    protected $table = 'visits';
22
23
    /**
24
     * The attributes that are mass assignable.
25
     *
26
     * @var array
27
     */
28
    protected $fillable = ['user_id'];
29
30
    /**
31
     * Define a polymorphic, inverse one-to-one or many relationship.
32
     *
33
     * @return MorphTo
34
     */
35
    public function visitable()
36
    {
37
        return $this->morphTo();
38
    }
39
40
    public function user()
41
    {
42
        return $this->belongsTo(Config::get('auth.providers.users.model'));
43
    }
44
}
45