Passed
Push — master ( 1d6d9a...2a90e7 )
by Ron
02:47 queued 12s
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
use Carbon\Carbon;
9
10
class TechTips extends Model
11
{
12
    use SoftDeletes;
13
14
    protected $primaryKey = 'tip_id';
15
    protected $fillable   = ['user_id', 'subject', 'tip_type_id', 'description'];
16
    protected $hidden     = ['public', 'user_id', 'deleted_at'];
17
    protected $casts      = [
18
        'created_at' => 'datetime:M d, Y',
19
        'updated_at' => 'datetime:M d, Y',
20
    ];
21
22 12
    public function systemTypes()
23
    {
24 12
        return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems', 'tip_id', 'sys_id', 'tip_id', 'sys_id');
25
    }
26
27 4
    public function user()
28
    {
29 4
        return $this->hasOne('App\User', 'user_id', 'user_id');
30
    }
31
32
    public function techTipTypes()
33
    {
34
        return $this->hasOne('App\TechTipTypes', 'tip_type_id', 'tip_type_id');
35
    }
36
37
    public function techTipSystems()
38
    {
39
        return $this->hasMany('App\TechTipSystems', 'tip_id', 'tip_id');
40
    }
41
}
42