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
|
|
|
|