ScheduleController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace WITR\Http\Controllers\Admin;
2
3
use WITR\Http\Requests;
4
use WITR\Http\Controllers\Controller;
5
use WITR\Schedule\WeeklySchedule;
6
use WITR\TimeSlot;
7
8
use Illuminate\Http\Request;
9
10
class ScheduleController extends Controller {
11
12
	public function __construct()
13
	{
14
		$this->middleware('auth');
15
		$this->middleware('editor');
16
	}
17
	
18
	/**
19
	 * Display a listing of the resource.
20
	 *
21
	 * @return Response
22
	 */
23
	public function index()
24
	{
25
		$schedule = WeeklySchedule::fromTimeSlots(TimeSlot::with('djForTimeslot', 'showForTimeslot')->get());
26
		return view('admin.schedule.index')->withSchedule($schedule);
27
	}
28
29
	/**
30
	 * Update the specified resource in storage.
31
	 *
32
	 * @param  int  $id
0 ignored issues
show
Bug introduced by
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
33
	 * @return Response
34
	 */
35
	public function update(Request $request)
36
	{
37
		$input = $request->all();
38
		$timeslots = TimeSlot::all();
39
40
		foreach ($timeslots as $timeslot) {
41
			$dj = $input['dj_' . $timeslot->id];
42
			$show = $input['show_' . $timeslot->id];
43
			$timeslot->dj = $dj;
44
			$timeslot->show = $show;
45
			$timeslot->save();
46
		}
47
	}
48
}
49