@@ -9,8 +9,8 @@ |
||
9 | 9 | namespace plunner\Console\Commands\Optimise; |
10 | 10 | |
11 | 11 | use Illuminate\Console\Scheduling\Schedule; |
12 | -use plunner\company; |
|
13 | 12 | use plunner\Events\Optimise\ErrorEvent; |
13 | +use plunner\company; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class Optimise |
@@ -302,8 +302,9 @@ discard block |
||
302 | 302 | static private function fillTimeSlots(array $array, $id, \Illuminate\Support\Collection $timeSlots, $fill = '0') |
303 | 303 | { |
304 | 304 | foreach ($timeSlots as $timeSlot) { |
305 | - if (!isset($array[$id])) |
|
306 | - $array[$id] = []; |
|
305 | + if (!isset($array[$id])) { |
|
306 | + $array[$id] = []; |
|
307 | + } |
|
307 | 308 | $array[$id] = self::arrayPadInterval($array[$id], $timeSlot->time_start, $timeSlot->time_end, $fill); |
308 | 309 | } |
309 | 310 | return $array; |
@@ -318,8 +319,9 @@ discard block |
||
318 | 319 | */ |
319 | 320 | static private function arrayPadInterval(array $array, $from, $to, $pad = '0') |
320 | 321 | { |
321 | - for ($i = $from; $i < $to; $i++) |
|
322 | - $array[$i] = $pad; |
|
322 | + for ($i = $from; $i < $to; $i++) { |
|
323 | + $array[$i] = $pad; |
|
324 | + } |
|
323 | 325 | return $array; |
324 | 326 | } |
325 | 327 | |
@@ -332,8 +334,9 @@ discard block |
||
332 | 334 | static private function fillRow(array $array, $id, $until, $fill = '0') |
333 | 335 | { |
334 | 336 | for ($i = 1; $i <= $until; $i++) { |
335 | - if (!isset($array[$id][$i])) |
|
336 | - $array[$id][$i] = $fill; |
|
337 | + if (!isset($array[$id][$i])) { |
|
338 | + $array[$id][$i] = $fill; |
|
339 | + } |
|
337 | 340 | } |
338 | 341 | |
339 | 342 | return $array; |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | $meeting = Meeting::findOrFail($meetingId); |
38 | 38 | $this->authorize($meeting); |
39 | 39 | |
40 | - if ($meeting->group_id == $groupId) |
|
41 | - return $meeting->timeslots; |
|
40 | + if ($meeting->group_id == $groupId) { |
|
41 | + return $meeting->timeslots; |
|
42 | + } |
|
42 | 43 | return Response::json(['error' => 'meeting->group_id <> groupId'], 403); |
43 | 44 | } |
44 | 45 | |
@@ -59,8 +60,9 @@ discard block |
||
59 | 60 | $timeslot = MeetingTimeslot::findOrFail($timeslotId); |
60 | 61 | $this->authorize($timeslot); |
61 | 62 | |
62 | - if ($meeting->group_id == $groupId && $timeslot->meeting_id == $meetingId) |
|
63 | - return $timeslot; |
|
63 | + if ($meeting->group_id == $groupId && $timeslot->meeting_id == $meetingId) { |
|
64 | + return $timeslot; |
|
65 | + } |
|
64 | 66 | return Response::json(['error' => 'meeting->group_id <> groupId || timeslot->meeting_id <> meetingId'], 403); |
65 | 67 | } |
66 | 68 |
@@ -2,11 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace plunner\Http\Controllers\Employees\Planners; |
4 | 4 | |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | use Illuminate\Support\Facades\Response; |
7 | 6 | use plunner\Group; |
8 | 7 | use plunner\Http\Controllers\Controller; |
9 | -use plunner\Http\Requests; |
|
10 | 8 | use plunner\Http\Requests\Employees\Meeting\MeetingTimeslotRequest; |
11 | 9 | use plunner\Meeting; |
12 | 10 | use plunner\MeetingTimeslot; |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace plunner\Http\Controllers\Companies\Employees; |
4 | 4 | |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | use plunner\Company; |
7 | 6 | use plunner\Employee; |
8 | 7 | use plunner\Http\Controllers\Controller; |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace plunner\Http\Controllers\Companies\Auth; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | -use plunner\Company; |
|
7 | -use plunner\Http\Controllers\Controller; |
|
8 | 6 | use Tymon\JWTAuth\Support\auth\AuthenticatesAndRegistersUsers; |
9 | 7 | use Tymon\JWTAuth\Support\auth\ThrottlesLogins; |
10 | 8 | use Validator; |
9 | +use plunner\Company; |
|
10 | +use plunner\Http\Controllers\Controller; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Class AuthController |
@@ -79,8 +79,9 @@ |
||
79 | 79 | if ($request->input('remember', false)) { |
80 | 80 | config(['jwt.ttl' => '43200']); //30 days |
81 | 81 | $this->custom = array_merge($this->custom, ['remember' => 'true']); |
82 | - } else |
|
83 | - $this->custom = array_merge($this->custom, ['remember' => 'false']); |
|
82 | + } else { |
|
83 | + $this->custom = array_merge($this->custom, ['remember' => 'false']); |
|
84 | + } |
|
84 | 85 | |
85 | 86 | return $this->postLoginOriginal($request); |
86 | 87 | } |
@@ -3,13 +3,12 @@ |
||
3 | 3 | namespace plunner\Http\Controllers\Employees\Auth; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | -use Log; |
|
7 | -use plunner\Company; |
|
8 | -use plunner\employee; |
|
9 | -use plunner\Http\Controllers\Controller; |
|
10 | 6 | use Tymon\JWTAuth\Support\auth\AuthenticatesAndRegistersUsers; |
11 | 7 | use Tymon\JWTAuth\Support\auth\ThrottlesLogins; |
12 | 8 | use Validator; |
9 | +use plunner\Company; |
|
10 | +use plunner\Http\Controllers\Controller; |
|
11 | +use plunner\employee; |
|
13 | 12 | |
14 | 13 | /** |
15 | 14 | * Class AuthController |
@@ -79,8 +79,9 @@ |
||
79 | 79 | if ($request->input('remember', false)) { |
80 | 80 | config(['jwt.ttl' => '43200']); //30 days |
81 | 81 | $this->custom = array_merge($this->custom, ['remember' => 'true']); |
82 | - } else |
|
83 | - $this->custom = array_merge($this->custom, ['remember' => 'false']); |
|
82 | + } else { |
|
83 | + $this->custom = array_merge($this->custom, ['remember' => 'false']); |
|
84 | + } |
|
84 | 85 | |
85 | 86 | return $this->postLoginOriginal($request); |
86 | 87 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | namespace plunner\Http\Controllers\Employees\Auth; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | +use Tymon\JWTAuth\Support\auth\ResetsPasswords; |
|
6 | 7 | use plunner\Company; |
7 | 8 | use plunner\Http\Controllers\Controller; |
8 | -use Tymon\JWTAuth\Support\auth\ResetsPasswords; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Class PasswordController |
@@ -2,11 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace plunner\Http\Controllers\Employees\Planners; |
4 | 4 | |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | use Illuminate\Support\Facades\Response; |
7 | 6 | use plunner\Group; |
8 | 7 | use plunner\Http\Controllers\Controller; |
9 | -use plunner\Http\Requests; |
|
10 | 8 | use plunner\Http\Requests\Employees\Meeting\MeetingTimeslotRequest; |
11 | 9 | use plunner\Meeting; |
12 | 10 | use plunner\MeetingTimeslot; |
@@ -2,11 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace plunner\Http\Controllers\Employees\Planners; |
4 | 4 | |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | use Illuminate\Support\Facades\Response; |
7 | 6 | use plunner\Group; |
8 | 7 | use plunner\Http\Controllers\Controller; |
9 | -use plunner\Http\Requests; |
|
10 | 8 | use plunner\Http\Requests\Employees\Meeting\MeetingTimeslotRequest; |
11 | 9 | use plunner\Meeting; |
12 | 10 | use plunner\MeetingTimeslot; |
@@ -58,10 +58,11 @@ discard block |
||
58 | 58 | //TODO insert a timeout |
59 | 59 | //TODO try...catch with destruct |
60 | 60 | $companyId = $this->argument('companyId'); |
61 | - if (is_numeric($companyId)) |
|
62 | - $this->makeForeground(Company::findOrFail($companyId)); |
|
63 | - else |
|
64 | - $this->syncAll(); |
|
61 | + if (is_numeric($companyId)) { |
|
62 | + $this->makeForeground(Company::findOrFail($companyId)); |
|
63 | + } else { |
|
64 | + $this->syncAll(); |
|
65 | + } |
|
65 | 66 | } |
66 | 67 | |
67 | 68 | /** |
@@ -81,13 +82,15 @@ discard block |
||
81 | 82 | if ($this->option('background')) { |
82 | 83 | \Log::debug(self::BACKGROUND_MOD_MEX); |
83 | 84 | $this->info(self::BACKGROUND_MOD_MEX); |
84 | - foreach ($calendars as $calendar) |
|
85 | - $this->makeBackground($calendar); |
|
85 | + foreach ($calendars as $calendar) { |
|
86 | + $this->makeBackground($calendar); |
|
87 | + } |
|
86 | 88 | \Log::debug(self::BACKGROUND_COMPLETED_MEX); |
87 | 89 | $this->info(self::BACKGROUND_COMPLETED_MEX); |
88 | - } else |
|
89 | - foreach ($calendars as $calendar) |
|
90 | + } else { |
|
91 | + foreach ($calendars as $calendar) |
|
90 | 92 | $this->makeForeground($calendar); |
93 | + } |
|
91 | 94 | } |
92 | 95 | |
93 | 96 | /** |
@@ -97,7 +100,8 @@ discard block |
||
97 | 100 | private function makeBackground(Company $company) |
98 | 101 | { |
99 | 102 | $event = $this->schedule->command('optimise:meetings ' . $company->id)->withoutOverlapping(); |
100 | - if ($event->isDue($this->laravel)) |
|
101 | - $event->run($this->laravel); |
|
103 | + if ($event->isDue($this->laravel)) { |
|
104 | + $event->run($this->laravel); |
|
105 | + } |
|
102 | 106 | } |
103 | 107 | } |