@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function __construct() |
| 13 | 13 | { |
| 14 | - config(['auth.model' => \plunner\Employee::class]); |
|
| 15 | - config(['jwt.user' => \plunner\Employee::class]); |
|
| 14 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
| 15 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
| 16 | 16 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | $employee = \Auth::user(); |
| 28 | 28 | $meetings = $employee->meetings(); |
| 29 | 29 | if ($request->query('current')) |
| 30 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 30 | + $meetings->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 32 | 32 | //datetime to consider timezone, don't use mysql NOW() |
| 33 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 33 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 34 | 34 | }); |
| 35 | 35 | return $meetings->get(); |
| 36 | 36 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | private static function getImg(Meeting $meeting) |
| 74 | 74 | { |
| 75 | - $name = 'meetings/' . $meeting->id; |
|
| 75 | + $name = 'meetings/'.$meeting->id; |
|
| 76 | 76 | if (!\Storage::exists($name)) |
| 77 | 77 | return false; |
| 78 | 78 | return \Storage::get($name); |
@@ -26,9 +26,11 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $employee = \Auth::user(); |
| 28 | 28 | $meetings = $employee->meetings(); |
| 29 | - if ($request->query('current')) |
|
| 30 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 29 | + if ($request->query('current')) { |
|
| 30 | + $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | + $query->where('start_time', '=', NULL); |
|
| 32 | + } |
|
| 33 | + //to be planned |
|
| 32 | 34 | //datetime to consider timezone, don't use mysql NOW() |
| 33 | 35 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 34 | 36 | }); |
@@ -63,9 +65,10 @@ discard block |
||
| 63 | 65 | $this->authorize($meeting); |
| 64 | 66 | $ret = self::getImg($meeting); |
| 65 | 67 | $blank = storage_path('img/meetings.jpg'); |
| 66 | - if ($ret === false) |
|
| 67 | - return (new Response(file_get_contents($blank), 200)) |
|
| 68 | + if ($ret === false) { |
|
| 69 | + return (new Response(file_get_contents($blank), 200)) |
|
| 68 | 70 | ->header('Content-Type', 'image/jpeg'); |
| 71 | + } |
|
| 69 | 72 | return (new Response($ret, 200)) |
| 70 | 73 | ->header('Content-Type', 'image/jpeg'); |
| 71 | 74 | } |
@@ -73,8 +76,9 @@ discard block |
||
| 73 | 76 | private static function getImg(Meeting $meeting) |
| 74 | 77 | { |
| 75 | 78 | $name = 'meetings/' . $meeting->id; |
| 76 | - if (!\Storage::exists($name)) |
|
| 77 | - return false; |
|
| 79 | + if (!\Storage::exists($name)) { |
|
| 80 | + return false; |
|
| 81 | + } |
|
| 78 | 82 | return \Storage::get($name); |
| 79 | 83 | } |
| 80 | 84 | } |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | - config(['auth.model' => \plunner\Planner::class]); |
|
| 18 | - config(['jwt.user' => \plunner\Planner::class]); |
|
| 17 | + config([ 'auth.model' => \plunner\Planner::class ]); |
|
| 18 | + config([ 'jwt.user' => \plunner\Planner::class ]); |
|
| 19 | 19 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $this->authorize($group); |
| 34 | 34 | $meetings = $group->meetings(); |
| 35 | 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 |
|
| 36 | + $meetings->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 38 | 38 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 39 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | return $meetings->get(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function storeImage(Requests\Request $request, $groupId, $meetingId) |
| 88 | 88 | { |
| 89 | - $this->validate($request, ['data' => 'required|image']); |
|
| 89 | + $this->validate($request, [ 'data' => 'required|image' ]); |
|
| 90 | 90 | $group = Group::findOrFail($groupId); |
| 91 | 91 | $this->authorize($group); |
| 92 | 92 | $meeting = Group::findOrFail($meetingId); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | private static function putImg($file, Meeting $meeting) |
| 100 | 100 | { |
| 101 | - \Storage::put('meetings/' . $meeting->id, \File::get($file)); |
|
| 101 | + \Storage::put('meetings/'.$meeting->id, \File::get($file)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | private static function getImg(Meeting $meeting) |
| 127 | 127 | { |
| 128 | - $name = 'meetings/' . $meeting->id; |
|
| 128 | + $name = 'meetings/'.$meeting->id; |
|
| 129 | 129 | if (!\Storage::exists($name)) |
| 130 | 130 | return false; |
| 131 | 131 | return \Storage::get($name); |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $this->authorize($meeting); |
| 148 | 148 | $input = $request->all(); |
| 149 | 149 | //the planner cannot modify the duration of a planed meeting |
| 150 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 151 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 150 | + if ($meeting->start_time != NULL && $meeting->duration != $input[ 'duration' ]) |
|
| 151 | + return Response::json([ 'error' => 'the meeting is already planned, you cannot change the duration' ], 422); |
|
| 152 | 152 | $meeting->update($input); |
| 153 | 153 | return $meeting; |
| 154 | 154 | } |
@@ -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 | }); |
@@ -116,9 +118,10 @@ discard block |
||
| 116 | 118 | $this->authorize($meeting); |
| 117 | 119 | $ret = self::getImg($meeting); |
| 118 | 120 | $blank = storage_path('img/meetings.jpg'); |
| 119 | - if ($ret === false) |
|
| 120 | - return (new Response(file_get_contents($blank), 200)) |
|
| 121 | + if ($ret === false) { |
|
| 122 | + return (new Response(file_get_contents($blank), 200)) |
|
| 121 | 123 | ->header('Content-Type', 'image/jpeg'); |
| 124 | + } |
|
| 122 | 125 | return (new Response($ret, 200)) |
| 123 | 126 | ->header('Content-Type', 'image/jpeg'); |
| 124 | 127 | } |
@@ -126,8 +129,9 @@ discard block |
||
| 126 | 129 | private static function getImg(Meeting $meeting) |
| 127 | 130 | { |
| 128 | 131 | $name = 'meetings/' . $meeting->id; |
| 129 | - if (!\Storage::exists($name)) |
|
| 130 | - return false; |
|
| 132 | + if (!\Storage::exists($name)) { |
|
| 133 | + return false; |
|
| 134 | + } |
|
| 131 | 135 | return \Storage::get($name); |
| 132 | 136 | } |
| 133 | 137 | |
@@ -147,8 +151,9 @@ discard block |
||
| 147 | 151 | $this->authorize($meeting); |
| 148 | 152 | $input = $request->all(); |
| 149 | 153 | //the planner cannot modify the duration of a planed meeting |
| 150 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 151 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 154 | + if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) { |
|
| 155 | + return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 156 | + } |
|
| 152 | 157 | $meeting->update($input); |
| 153 | 158 | return $meeting; |
| 154 | 159 | } |