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

FileLinks   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 38
rs 10
c 1
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A fileLinkFiles() 0 3 1
A users() 0 3 1
A fileLinkNotes() 0 3 1
A customers() 0 3 1
A fileLinkInstructions() 0 3 1
A getAllowUploadAttribute() 0 3 2
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