/**
  * Store a newly created resource in storage.
  *
  * @param Requests\TimeslotRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\TimeslotRequest $request)
 {
     $input = $this->getFormInput($request);
     $job = new CreateTimeslot($input->day, $input->begin, $input->end, $input->rooms);
     $timeslot = $job->handle();
     return redirect('/week');
 }
 public function test_it_makes_a_new_timeslot()
 {
     $input = ['day_id' => 1, 'begin' => Carbon::now(), 'end' => Carbon::now()->addHours(2)];
     $rooms = factory(Room::class)->times(3)->create();
     $job = new CreateTimeslot($input['day_id'], $input['begin'], $input['end'], $rooms);
     $timeslot = $job->handle();
     $this->seeInDatabase('timeslots', ['day_id' => $input['day_id'], 'begin' => $input['begin'], 'end' => $input['end']]);
     foreach ($rooms as $room) {
         $this->seeInDatabase('room_timeslots', ['room_id' => $room->id, 'timeslot_id' => $timeslot->id]);
     }
 }