Favorite::favoriteable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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