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

LessonsSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 38
ccs 0
cts 19
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 1
A createLesson() 0 8 1
1
<?php
2
3
namespace Scool\Timetables\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
use Scool\Timetables\Models\Classroom;
7
use Scool\Timetables\Models\Day;
8
use Scool\Timetables\Models\Lesson;
9
use Scool\Timetables\Models\Location;
10
use Scool\Timetables\Models\Timeslot;
11
12
13
/**
14
 * Class LessonsSeeder
15
 * @package Scool\Timetables\Database\Seeds
16
 */
17
class LessonsSeeder extends Seeder
18
{
19
    /**
20
     * Run the database seeds.
21
     *
22
     * @return void
23
     */
24
    public function run()
25
    {
26
       $user = \App\User::find(2);
27
       $location = Location::find(3);
28
       $day = Day::find(2);
29
       $timeslot = Timeslot::find(7);
30
       $classroom = Classroom::find(1);
31
       $lesson = $this->createLesson();
32
       $location->lessons()->save($lesson);
33
       $day->lessons()->save($lesson);
34
       $timeslot->lessons()->save($lesson);
35
       $classroom->lessons()->save($lesson);
36
       $lesson->users()->save($user);
37
       $lesson->step1step2();
38
    }
39
40
41
    /**
42
     * Creates a lesson
43
     *
44
     * @return mixed
45
     */
46
    private function createLesson()
47
    {
48
       return Lesson::firstOrCreate([]);
49
//       $lesson->days()->save(Day::find($day));
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
//       $lesson->timeslots()->save(Timeslot::find($timeslot));
51
//       $lesson->classrooms()->save(Classroom::find($classroom));
52
//       return $lesson;
53
    }
54
}
55