Passed
Push — dev5 ( 6e89ff...3685b3 )
by Ron
05:58
created

TechTips::techTipSystems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class TechTips extends Model
8
{
9
    protected $primaryKey = 'tip_id';
10
    protected $fillable = ['user_id', 'subject', 'tip_type_id', 'description', 'created_at'];  // ToDo:  Remove Created_at - future build
11
    protected $casts = [
12
        'created_at' => 'datetime:M d, Y',
13
        'updated_at' => 'datetime:M d, Y',
14
    ];
15
16
    public function systemTypes()
17
    {
18
        return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems',  'tip_id', 'sys_id', 'tip_id', 'sys_id');
19
    }
20
21
//     public function user()
22
//     {
23
//         return $this->hasOne('App\User', 'user_id', 'user_id');
24
//     }
25
26
//     public function techTipComments()
27
//     {
28
//         return $this->belongsTo('App\TechTipComments', 'tip_id', 'tip_id');
29
//     }
30
31
//     public function techTipFiles()
32
//     {
33
//         return $this->belongsTo('App\TechTipFiles', 'tip_id', 'tip_id');
34
//     }
35
36
    public function techTipSystems()
37
    {
38
        return $this->hasMany('App\TechTipSystems', 'tip_id', 'tip_id');
39
    }
40
}
41