Passed
Push — dev5 ( 3ab1f5...1f5b4d )
by Ron
06:22
created

TechTips   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 35
ccs 4
cts 6
cp 0.6667
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A systemTypes() 0 3 1
A techTipSystems() 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 10
    public function systemTypes()
21
    {
22 10
        return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems',  'tip_id', 'sys_id', 'tip_id', 'sys_id');
23
    }
24
25 2
    public function user()
26
    {
27 2
        return $this->hasOne('App\User', 'user_id', 'user_id');
28
    }
29
30
//     public function techTipComments()
31
//     {
32
//         return $this->belongsTo('App\TechTipComments', 'tip_id', 'tip_id');
33
//     }
34
35
//     public function techTipFiles()
36
//     {
37
//         return $this->belongsTo('App\TechTipFiles', 'tip_id', 'tip_id');
38
//     }
39
40
    public function techTipSystems()
41
    {
42
        return $this->hasMany('App\TechTipSystems', 'tip_id', 'tip_id');
43
    }
44
}
45