Passed
Push — dev5 ( 3685b3...3ab1f5 )
by Ron
07:25
created

TechTips   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 32
ccs 2
cts 4
cp 0.5
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A techTipSystems() 0 3 1
A systemTypes() 0 3 1
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 8
    public function systemTypes()
17
    {
18 8
        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