Vote::user()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yoeunes\Voteable\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Vote extends Model
8
{
9
    /**
10
     * The attributes that are mass assignable.
11
     *
12
     * @var array
13
     */
14
    protected $fillable = [
15
        'amount',
16
        'user_id',
17
        'voteable_id',
18
        'voteable_type',
19
    ];
20
21
    /**
22
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
23
     */
24
    public function voteable()
25
    {
26
        return $this->morphTo();
27
    }
28
29
    /**
30
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
31
     */
32
    public function user()
33
    {
34
        return $this->belongsTo(config('voteable.user'));
35
    }
36
}
37