Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param int $meetingId
  * @return static
  */
 public function showImage($meetingId)
 {
     $meeting = Meeting::findOrFail($meetingId);
     $this->authorize($meeting);
     $ret = self::getImg($meeting);
     $blank = storage_path('img/meetings.jpg');
     if ($ret === false) {
         return (new Response(file_get_contents($blank), 200))->header('Content-Type', 'image/jpeg');
     }
     return (new Response($ret, 200))->header('Content-Type', 'image/jpeg');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param int $groupId
  * @param int $meetingId
  * @param int $timeslotId
  * @return mixed
  */
 public function destroy($groupId, $meetingId, $timeslotId)
 {
     $group = Group::findOrFail($groupId);
     $this->authorize($group);
     $meeting = Meeting::findOrFail($meetingId);
     $this->authorize($meeting);
     if ($meeting->start_time != NULL) {
         return Response::json(['error' => 'the meeting is already planned'], 422);
     }
     $timeslot = MeetingTimeslot::findOrFail($timeslotId);
     $this->authorize($timeslot);
     if ($meeting->group_id == $groupId && $timeslot->meeting_id == $meetingId) {
         $timeslot->delete();
         return $timeslot;
     }
     return Response::json(['error' => 'meeting->group_id <> groupId || timeslot->meeting_id <> meetingId'], 403);
 }
Exemplo n.º 3
0
 /**
  * @param Solver $solver
  */
 private function saveMeetings(Solver $solver)
 {
     $meetings = $solver->getYResults();
     foreach ($meetings as $id => $meeting) {
         $meetingO = \plunner\Meeting::findOrFail($id);
         //TODO catch error
         $meetingO->start_time = $this->toDateTime(array_search('1', $meeting));
         $meetingO->save();
     }
 }
Exemplo n.º 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $groupId
  * @param int $meetingId
  * @return mixed
  */
 public function destroy($groupId, $meetingId)
 {
     $group = Group::findOrFail($groupId);
     $this->authorize($group);
     $meeting = Meeting::findOrFail($meetingId);
     $this->authorize($meeting);
     $meeting->delete();
     return $meeting;
 }