Attachment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 55
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A attachmentable() 0 4 1
A user() 0 4 1
1
<?php
2
/**
3
 * GitScrum v0.1.
4
 *
5
 * @author  Renato Marinho <[email protected]>
6
 * @license http://opensource.org/licenses/GPL-3.0 GPLv3
7
 */
8
9
namespace GitScrum\Models;
10
11
use Illuminate\Database\Eloquent\Model;
12
use Illuminate\Database\Eloquent\SoftDeletes;
13
14
class Attachment extends Model
15
{
16
    use SoftDeletes;
17
18
    /**
19
     * The database table used by the model.
20
     *
21
     * @var string
22
     */
23
    protected $table = 'attachments';
24
25
    /**
26
     * Attributes that should be mass-assignable.
27
     *
28
     * @var array
29
     */
30
    protected $fillable = ['attachmentable_type', 'attachmentable_id', 'user_id',
31
        'filename_original', 'filename_new', 'mimetype', 'size', ];
32
33
    /**
34
     * The attributes excluded from the model's JSON form.
35
     *
36
     * @var array
37
     */
38
    protected $hidden = [];
39
40
    /**
41
     * The attributes that should be casted to native types.
42
     *
43
     * @var array
44
     */
45
    protected $casts = [];
46
47
    /**
48
     * The attributes that should be mutated to dates.
49
     *
50
     * @var array
51
     */
52
    protected $dates = ['deleted_at'];
53
54
    protected static function boot()
55
    {
56
        parent::boot();
57
    }
58
59
    public function attachmentable()
60
    {
61
        return $this->morphTo('attachmentable');
62
    }
63
64
    public function user()
65
    {
66
        return $this->belongsTo(\GitScrum\Models\User::class, 'user_id', 'id');
67
    }
68
}
69