Favorite   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 32
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A favoriteable() 0 4 1
A user() 0 4 1
1
<?php
2
/**
3
 * GitScrum v0.1.
4
 *
5
 * @author  Renato Marinho <[email protected]>
6
 * @license http://opensource.org/licenses/GPL-3.0 GPLv3
7
 */
8
9
namespace GitScrum\Models;
10
11
use Illuminate\Database\Eloquent\Model;
12
use GitScrum\Scopes\GlobalScope;
13
14
class Favorite extends Model
15
{
16
    use GlobalScope;
17
    /**
18
     * The database table used by the model.
19
     *
20
     * @var string
21
     */
22
    protected $table = 'favorites';
23
24
    /**
25
     * Attributes that should be mass-assignable.
26
     *
27
     * @var array
28
     */
29
    protected $fillable = ['favoriteable_type', 'favoriteable_id', 'user_id'];
30
31
    protected static function boot()
32
    {
33
        parent::boot();
34
    }
35
36
    public function favoriteable()
37
    {
38
        return $this->morphTo('favoriteable');
39
    }
40
41
    public function user()
42
    {
43
        return $this->belongsTo(\GitScrum\Models\User::class, 'user_id', 'id');
44
    }
45
}
46