Passed
Push — master ( 2a90e7...a622eb )
by Ron
02:27 queued 14s
created

TechTips   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 31
ccs 4
cts 8
cp 0.5
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
use Carbon\Carbon;
9
10
class TechTips extends Model
11
{
12
    use SoftDeletes;
13
14
    protected $primaryKey = 'tip_id';
15
    protected $fillable   = ['user_id', 'updated_id', 'subject', 'tip_type_id', 'description', 'public', 'sticky'];
16
    protected $hidden     = ['public', 'user_id', 'updated_id', 'deleted_at'];
17
    protected $casts      = [
18
        'created_at' => 'datetime:M d, Y',
19
        'updated_at' => 'datetime:M d, Y',
20
        'sticky'     => 'boolean',
21
    ];
22
23 12
    public function systemTypes()
24
    {
25 12
        return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems', 'tip_id', 'sys_id', 'tip_id', 'sys_id');
26
    }
27
28 4
    public function user()
29
    {
30 4
        return $this->hasOne('App\User', 'user_id', 'user_id');
31
    }
32
33
    public function techTipTypes()
34
    {
35
        return $this->hasOne('App\TechTipTypes', 'tip_type_id', 'tip_type_id');
36
    }
37
38
    public function techTipSystems()
39
    {
40
        return $this->hasMany('App\TechTipSystems', 'tip_id', 'tip_id');
41
    }
42
}
43