@@ -39,10 +39,11 @@ |
||
39 | 39 | { |
40 | 40 | // |
41 | 41 | $companyId = $this->argument('companyId'); |
42 | - if (is_numeric($companyId)) |
|
43 | - print_r(Company::with(self::withFilter())->findOrFail($companyId)->toArray()); |
|
44 | - else |
|
45 | - print_r(Company::with(self::withFilter())->select('id')->get()->toArray()); |
|
42 | + if (is_numeric($companyId)) { |
|
43 | + print_r(Company::with(self::withFilter())->findOrFail($companyId)->toArray()); |
|
44 | + } else { |
|
45 | + print_r(Company::with(self::withFilter())->select('id')->get()->toArray()); |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | private static function withFilter() |
@@ -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 | } |
@@ -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 | } |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | //$this->authorize($meeting); |
28 | 28 | $ret = self::getImg($meeting); |
29 | 29 | $blank = storage_path('img/meetings.jpg'); |
30 | - if ($ret === false) |
|
31 | - return (new Response(file_get_contents($blank), 200)) |
|
30 | + if ($ret === false) { |
|
31 | + return (new Response(file_get_contents($blank), 200)) |
|
32 | 32 | ->header('Content-Type', 'image/jpeg'); |
33 | + } |
|
33 | 34 | return (new Response($ret, 200)) |
34 | 35 | ->header('Content-Type', 'image/jpeg'); |
35 | 36 | } |
@@ -37,8 +38,9 @@ discard block |
||
37 | 38 | private static function getImg(Meeting $meeting) |
38 | 39 | { |
39 | 40 | $name = 'meetings/' . $meeting->id; |
40 | - if (!\Storage::exists($name)) |
|
41 | - return false; |
|
41 | + if (!\Storage::exists($name)) { |
|
42 | + return false; |
|
43 | + } |
|
42 | 44 | return \Storage::get($name); |
43 | 45 | } |
44 | 46 | } |