Completed
Push — dev5 ( cf4e4a...8e8b96 )
by Ron
08:41
created

FileLinks::customers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class FileLinks extends Model
8
{
9
    protected $primaryKey = 'link_id';
10
    protected $fillable = ['user_id', 'cust_id', 'link_hash', 'link_name', 'note', 'expire', 'allow_upload'];
11
    protected $casts = [
12
        'created_at' => 'datetime:M d, Y',
13
        'updated_at' => 'datetime:M d, Y',
14
        'expire'     => 'datetime:M d, Y'
15
    ];
16
17
    public function getAllowUploadAttribute()
18
    {
19
        return $this->attributes['allow_upload'] ? 'Yes' : 'No';
20
    }
21
22
    public function users()
23
    {
24
        return $this->belongsTo('App\Users', 'user_id', 'user_id');
25
    }
26
27
    public function fileLinkFiles()
28
    {
29
        return $this->belongsTo('App\FileLinkFiles', 'link_id', 'link_id');
30
    }
31
32
    public function fileLinkInstructions()
33
    {
34
        return $this->hasMany('App\FileLinkInstructions', 'link_id', 'link_id');
35
    }
36
37
    public function fileLinkNotes()
38
    {
39
        return $this->hasMany('App\FileLinkNotes', 'link_id', 'link_id');
40
    }
41
42
    public function customers()
43
    {
44
        return $this->belongsTo('App\Customers', 'cust_id', 'cust_id');
45
    }
46
}
47