@@ -32,9 +32,11 @@ discard block |
||
| 32 | 32 | $group = Group::findOrFail($groupId); |
| 33 | 33 | $this->authorize($group); |
| 34 | 34 | $meetings = $group->meetings(); |
| 35 | - if ($request->query('current')) |
|
| 36 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 35 | + if ($request->query('current')) { |
|
| 36 | + $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); |
|
| 38 | + } |
|
| 39 | + //to be planned |
|
| 38 | 40 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | 41 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 40 | 42 | }); |
@@ -115,8 +117,9 @@ discard block |
||
| 115 | 117 | $meeting = Group::findOrFail($meetingId); |
| 116 | 118 | $this->authorize($meeting); |
| 117 | 119 | $ret = self::getImg($meeting); |
| 118 | - if ($ret === false) |
|
| 119 | - return \Response::json(['error' => 'The file is not uploaded'], 404); |
|
| 120 | + if ($ret === false) { |
|
| 121 | + return \Response::json(['error' => 'The file is not uploaded'], 404); |
|
| 122 | + } |
|
| 120 | 123 | return (new Response($ret, 200)) |
| 121 | 124 | ->header('Content-Type', 'image/jpeg'); |
| 122 | 125 | } |
@@ -124,8 +127,9 @@ discard block |
||
| 124 | 127 | private static function getImg(Meeting $meeting) |
| 125 | 128 | { |
| 126 | 129 | $name = 'meetings/' . $meeting->id; |
| 127 | - if (!\Storage::exists($name)) |
|
| 128 | - return false; |
|
| 130 | + if (!\Storage::exists($name)) { |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 129 | 133 | return \Storage::get($name); |
| 130 | 134 | } |
| 131 | 135 | |
@@ -145,8 +149,9 @@ discard block |
||
| 145 | 149 | $this->authorize($meeting); |
| 146 | 150 | $input = $request->all(); |
| 147 | 151 | //the planner cannot modify the duration of a planed meeting |
| 148 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 149 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 152 | + if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) { |
|
| 153 | + return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 154 | + } |
|
| 150 | 155 | $meeting->update($input); |
| 151 | 156 | return $meeting; |
| 152 | 157 | } |