Branch::issues()   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
13
class Branch extends Model
14
{
15
    /**
16
     * The database table used by the model.
17
     *
18
     * @var string
19
     */
20
    protected $table = 'branches';
21
22
    /**
23
     * Attributes that should be mass-assignable.
24
     *
25
     * @var array
26
     */
27
    protected $fillable = ['user_id', 'sprint_id', 'product_backlog_id', 'sha', 'title', 'deleted_at'];
28
29
    /**
30
     * The attributes excluded from the model's JSON form.
31
     *
32
     * @var array
33
     */
34
    protected $hidden = [];
35
36
    /**
37
     * The attributes that should be casted to native types.
38
     *
39
     * @var array
40
     */
41
    protected $casts = [];
42
43
    /**
44
     * The attributes that should be mutated to dates.
45
     *
46
     * @var array
47
     */
48
    protected $dates = ['deleted_at'];
49
50
    public function ProductBacklog()
51
    {
52
        return $this->belongsTo(\GitScrum\Models\ProductBacklog::class, 'product_backlog_id', 'id');
53
    }
54
55
    public function sprint()
56
    {
57
        return $this->belongsTo(\GitScrum\Models\Sprint::class, 'sprint_id', 'id');
58
    }
59
60
    public function user()
61
    {
62
        return $this->belongsTo(\GitScrum\Models\User::class, 'user_id', 'id');
63
    }
64
65
    public function commits()
66
    {
67
        return $this->hasMany(\GitScrum\Models\Commit::class, 'branch_id', 'id');
68
    }
69
70
    public function issues()
71
    {
72
        return $this->hasMany(\GitScrum\Models\Issue::class, 'branch_id', 'id');
73
    }
74
75
    public function basePullRequests()
76
    {
77
        return $this->hasMany(\GitScrum\Models\PullRequest::class, 'base_branch_id', 'id');
78
    }
79
80
    public function headPullRequests()
81
    {
82
        return $this->hasMany(\GitScrum\Models\PullRequest::class, 'head_branch_id', 'id');
83
    }
84
}
85