Completed
Push — master ( 5e49b6...2ab591 )
by David Martínez
07:18
created

Timeslot::lessons()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\Timetables\Models;
4
5
use Acacha\Names\Traits\Nameable;
6
use Illuminate\Database\Eloquent\Model;
7
8
9
/**
10
 * Class Timeslot
11
 * @package Scool\Timetables\Models
12
 */
13
class Timeslot extends Model
14
{
15
    use Nameable;
16
17
    protected $fillable = [
18
         'name', 'init_hour', 'final_hour'
19
    ];
20
21
    /**
22
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
23
     */
24
    public function shifts()
25
    {
26
        return $this->belongsToMany(Shift::class)->withTimestamps();
27
    }
28
29
    public function lessons()
30
    {
31
        return $this->hasMany(\Scool\Timetables\Models\Lesson::class);
32
    }
33
}
34