@@ -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 | }); |
@@ -91,8 +93,9 @@ discard block |
||
| 91 | 93 | $meeting = Meeting::findOrFail($meetingId); |
| 92 | 94 | $this->authorize($meeting); |
| 93 | 95 | $input = $request->all(); |
| 94 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 95 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 96 | + if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) { |
|
| 97 | + return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 98 | + } |
|
| 96 | 99 | $meeting->update($input); |
| 97 | 100 | return $meeting; |
| 98 | 101 | } |