Group   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 55
ccs 9
cts 12
cp 0.75
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPlannerNameAttribute() 0 6 3
A employees() 0 4 1
A planner() 0 4 1
A company() 0 4 1
A meetings() 0 4 1
1
<?php
2
3
namespace plunner;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class Group
9
 *
10
 * @author Claudio Cardinale <[email protected]>
11
 * @copyright 2015 Claudio Cardinale
12
 * @version 1.0.0
13
 * @package plunner
14
 * @property integer $id
15
 * @property \Carbon\Carbon $created_at
16
 * @property \Carbon\Carbon $updated_at
17
 * @property string $name
18
 * @property string $description
19
 * @property integer $company_id
20
 * @property integer $planner_id
21
 * @property-read mixed $planner_name
22
 * @property-read \Illuminate\Database\Eloquent\Collection|\plunner\Employee[] $employees
23
 * @property-read \plunner\Planner $planner
24
 * @property-read \plunner\Company $company
25
 * @property-read \Illuminate\Database\Eloquent\Collection|\plunner\Meeting[] $meetings
26
 */
27
class Group extends Model
28
{
29
    /**
30
     * The attributes that are mass assignable.
31
     *
32
     * @var array
33
     */
34
    protected $fillable = ['name', 'description', 'planner_id'];
35
36
    /**
37
     * @var array
38
     */
39
    protected $hidden = ['planner', 'pivot'];
40
41
    /**
42
     * @var array
43
     */
44
    protected $appends = ['planner_name'];
45
46 54
    public function getPlannerNameAttribute()
47
    {
48 54
        if (is_object($this->planner) && $this->planner->exists)
49 54
            return $this->planner->name;
50
        return null;
51
    }
52
53
    /**
54
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
55
     */
56 48
    public function employees()
57
    {
58 48
        return $this->belongsToMany(Employee::class);
59
    }
60
61
    /**
62
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
63
     */
64 141
    public function planner()
65
    {
66 141
        return $this->belongsTo(Planner::class);
67
    }
68
69
    /**
70
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
71
     */
72
    public function company()
73
    {
74
        return $this->belongsTo(Company::class);
75
    }
76
77 117
    public function meetings()
78
    {
79 117
        return $this->hasMany(Meeting::class);
80
    }
81
}
82