Passed
Push — dev5 ( 1f5b4d...1c738e )
by Ron
05:57
created

TechTips   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 40
ccs 6
cts 8
cp 0.75
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A systemTypes() 0 3 1
A techTipSystems() 0 3 1
A techTipTypes() 0 3 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class TechTips extends Model
9
{
10
    use SoftDeletes;
11
12
    protected $primaryKey = 'tip_id';
13
    protected $fillable = ['user_id', 'subject', 'tip_type_id', 'description', 'created_at'];  // ToDo:  Remove Created_at - future build
14
    protected $hidden = ['public', 'user_id', 'tip_type_id'];
15
    protected $casts = [
16
        'created_at' => 'datetime:M d, Y',
17
        'updated_at' => 'datetime:M d, Y',
18
    ];
19
20 12
    public function systemTypes()
21
    {
22 12
        return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems',  'tip_id', 'sys_id', 'tip_id', 'sys_id');
23
    }
24
25 4
    public function user()
26
    {
27 4
        return $this->hasOne('App\User', 'user_id', 'user_id');
28
    }
29
30 2
    public function techTipTypes()
31
    {
32 2
        return $this->hasOne('App\TechTipTypes', 'tip_type_id', 'tip_type_id');
33
    }
34
35
//     public function techTipComments()
36
//     {
37
//         return $this->belongsTo('App\TechTipComments', 'tip_id', 'tip_id');
38
//     }
39
40
//     public function techTipFiles()
41
//     {
42
//         return $this->belongsTo('App\TechTipFiles', 'tip_id', 'tip_id');
43
//     }
44
45
    public function techTipSystems()
46
    {
47
        return $this->hasMany('App\TechTipSystems', 'tip_id', 'tip_id');
48
    }
49
}
50