Completed
Pull Request — master (#48)
by claudio
05:21
created

Meeting::employees()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 2
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace plunner;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class Meeting
9
 *
10
 * @package plunner
11
 * @author Claudio Cardinale <[email protected]>
12
 * @copyright 2015 Claudio Cardinale
13
 * @version 1.0.0
14
 * @property integer $id
15
 * @property string $title
16
 * @property string $description
17
 * @property string $meeting_start
18
 * @property string $meeting_end
19
 * @property \Carbon\Carbon $created_at
20
 * @property \Carbon\Carbon $updated_at
21
 * @property-read \Illuminate\Database\Eloquent\Collection|\plunner\Employee[] $employees
22
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereId($value)
23
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereTitle($value)
24
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereDescription($value)
25
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereMeetingStart($value)
26
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereMeetingEnd($value)
27
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereCreatedAt($value)
28
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereUpdatedAt($value)
29
 * @property integer $utc
30
 * @property integer $repeat
31
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereUtc($value)
32
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereRepeat($value)
33
 * @property integer $group_id
34
 * @property string $start_time
35
 * @property integer $duration
36
 * @property-read Group $group
37
 * @property-read \Illuminate\Database\Eloquent\Collection|\plunner\MeetingTimeslot[] $timeslots
38
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereGroupId($value)
39
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereStartTime($value)
40
 * @method static \Illuminate\Database\Query\Builder|\plunner\Meeting whereDuration($value)
41
 */
42
class Meeting extends Model
43
{
44
    /**
45
     * The attributes that are mass assignable.
46
     *
47
     * @var array
48
     */
49
    protected $fillable = ['title', 'description', 'duration'];
50
51
    /**
52
     * The attributes excluded from the model's JSON form.
53
     *
54
     * @var array
55
     */
56
    protected $hidden = ['pivot'];
57
58
59
    /**
60
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
61
     */
62 16
    public function group()
63
    {
64 16
        return $this->belongsTo(Group::class);
65
    }
66
67
    /**
68
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
69
     */
70 2
    public function timeslots()
71
    {
72 2
        return $this->hasMany('plunner\MeetingTimeslot');
73
    }
74
75
    /**
76
     * get employees that partecipate to the meetings.
77
     * for all employees invited use groups with employees
78
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
79
     */
80
    public function employees()
81
    {
82
        return $this->belongsToMany(Employee::class);
83
    }
84
}
85