Source   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 43
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A type() 0 3 1
A getCitationListAttribute() 0 3 1
A publication() 0 3 1
A citations() 0 3 1
A repositories() 0 3 1
A author() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Source extends Model
8
{
9
    /**
10
     * The "type" of the auto-incrementing ID.
11
     *
12
     * @var string
13
     */
14
    protected $keyType = 'integer';
15
16
    protected $fillable = ['sour', 'titl', 'auth', 'data', 'text', 'publ', 'abbr', 'name', 'description', 'repository_id', 'author_id', 'publication_id', 'type_id', 'is_active', 'group', 'gid', 'quay', 'page'];
17
18
    protected $attributes = ['is_active' => false];
19
20
    protected $casts = ['is_active' => 'boolean'];
21
22
    public function repositories()
23
    {
24
        return $this->belongsTo(Repository::class);
25
    }
26
27
    public function citations()
28
    {
29
        return $this->hasMany(Citation::class);
30
    }
31
32
    public function publication()
33
    {
34
        return $this->belongsTo(Publication::class);
35
    }
36
37
    public function type()
38
    {
39
        return $this->belongsTo(Type::class);
40
    }
41
42
    public function author()
43
    {
44
        return $this->belongsTo(Author::class);
45
    }
46
47
    public function getCitationListAttribute()
48
    {
49
        return $this->citations()->pluck('citation.id');
50
    }
51
}
52