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

TechTips::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

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 2
cts 2
cp 1
crap 1
rs 10
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