Visit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A visitable() 0 3 1
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