Vote   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

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