@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Return list of users who were destroyed. |
50 | - * @return mixed |
|
50 | + * @return Collection |
|
51 | 51 | */ |
52 | 52 | public function getDestroyed() |
53 | 53 | { |
@@ -56,14 +56,14 @@ |
||
56 | 56 | |
57 | 57 | public function setDestroyed() |
58 | 58 | { |
59 | - $deadmanList = User::where(function ($q) { |
|
59 | + $deadmanList = User::where(function($q) { |
|
60 | 60 | $q->where('status', 'separated')->orWhere('status', 'destroyed'); |
61 | 61 | }) |
62 | - ->whereBetween('destroyed_date', [Carbon::today(),Carbon::today()->addDays(6)]) |
|
62 | + ->whereBetween('destroyed_date', [Carbon::today(), Carbon::today()->addDays(6)]) |
|
63 | 63 | ->get(); |
64 | 64 | |
65 | 65 | foreach ($deadmanList as $user) { |
66 | - Storage::deleteDirectory('user_'.$user->id); |
|
66 | + Storage::deleteDirectory('user_' . $user->id); |
|
67 | 67 | $user->delete(); |
68 | 68 | } |
69 | 69 |
@@ -129,8 +129,8 @@ |
||
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @param $trainingUser |
132 | - * @param $dueDate |
|
133 | - * @return static |
|
132 | + * @param Carbon $dueDate |
|
133 | + * @return TrainingUser |
|
134 | 134 | */ |
135 | 135 | private function createRecord($trainingUser, $dueDate) |
136 | 136 | { |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Take a list of notes and return a list of supervisors related to those notes. |
138 | - * @return static |
|
138 | + * @return Collection |
|
139 | 139 | */ |
140 | 140 | private function getSupervisors() |
141 | 141 | { |
@@ -70,16 +70,16 @@ |
||
70 | 70 | |
71 | 71 | $newNotes = new Collection(); |
72 | 72 | |
73 | - $this->trainingUsers->each( function( $item, $key ) use ($supervisor, $newNotes) { |
|
74 | - if ( $item->user->supervisor_id == $supervisor->id ) { |
|
73 | + $this->trainingUsers->each(function($item, $key) use ($supervisor, $newNotes) { |
|
74 | + if ($item->user->supervisor_id == $supervisor->id) { |
|
75 | 75 | $newNotes->push($item); |
76 | 76 | } |
77 | 77 | }); |
78 | 78 | |
79 | 79 | if (!$newNotes->isEmpty()) { |
80 | - Mail::send('emails.supervisor_reminder', ['notes' => $newNotes], function ($m) use ($supervisor) { |
|
80 | + Mail::send('emails.supervisor_reminder', ['notes' => $newNotes], function($m) use ($supervisor) { |
|
81 | 81 | $m->to($supervisor->email, $supervisor->userFullName) |
82 | - ->subject($supervisor->email.' Training that your employees need to complete.'); |
|
82 | + ->subject($supervisor->email . ' Training that your employees need to complete.'); |
|
83 | 83 | }); |
84 | 84 | } |
85 | 85 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Execute the console command. |
35 | - * @return mixed |
|
35 | + * @return UpdateDuty |
|
36 | 36 | */ |
37 | 37 | public function handle() |
38 | 38 | { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | /** |
114 | 114 | * @param $duty |
115 | - * @param $date |
|
115 | + * @param Carbon $date |
|
116 | 116 | * @return string |
117 | 117 | */ |
118 | 118 | private function generateICS($duty, $date) |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | /** |
169 | 169 | * @param $duty |
170 | 170 | * @param $usersDateArray |
171 | - * @return mixed |
|
171 | + * @return UpdateDuty |
|
172 | 172 | */ |
173 | 173 | private function sendUsersUpcomingEmailNotification($duty, $usersDateArray) |
174 | 174 | { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | |
48 | 48 | private function processEmailList($emailList, $duty) |
49 | 49 | { |
50 | - foreach($emailList as $usersDateArray) { |
|
51 | - if ($usersDateArray['date'] == Carbon::today()->format('Y-m-d')){ |
|
50 | + foreach ($emailList as $usersDateArray) { |
|
51 | + if ($usersDateArray['date'] == Carbon::today()->format('Y-m-d')) { |
|
52 | 52 | foreach ($usersDateArray['users'] as $user) { |
53 | 53 | $this->sendTodaysNotification($user, $duty); |
54 | 54 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | Mail::send('emails.duty_today', [ |
72 | 72 | 'user' => $user, |
73 | 73 | 'duty' => $duty |
74 | - ], function ($m) use ($user, $duty) { |
|
74 | + ], function($m) use ($user, $duty) { |
|
75 | 75 | $m->to($user->email, $user->userFullName) |
76 | 76 | ->subject('Reminder: You have ' . $duty->name . ' security check today.'); |
77 | 77 | }); |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | 'user' => $user, |
85 | 85 | 'date' => $date, |
86 | 86 | 'duty' => $duty |
87 | - ], function ($m) use ($user, $duty, $date) { |
|
87 | + ], function($m) use ($user, $duty, $date) { |
|
88 | 88 | |
89 | - $filename = $this->generateICS($duty, Carbon::createFromFormat('Y-m-d',$date)); |
|
89 | + $filename = $this->generateICS($duty, Carbon::createFromFormat('Y-m-d', $date)); |
|
90 | 90 | |
91 | 91 | if ($duty->cycle = 'daily') { |
92 | 92 | $subject = "You have $duty->name security check on $date."; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | */ |
107 | 107 | private function isReadyForNotification($duty, $usersDateArray) |
108 | 108 | { |
109 | - return ( $duty->cycle == 'weekly' && $usersDateArray['date'] == Carbon::today()->addWeeks(2)->format('Y-m-d') ) |
|
110 | - || ( $duty->cycle == 'daily' && $usersDateArray['date'] == Carbon::today()->addWeeks(1)->format('Y-m-d') ); |
|
109 | + return ($duty->cycle == 'weekly' && $usersDateArray['date'] == Carbon::today()->addWeeks(2)->format('Y-m-d')) |
|
110 | + || ($duty->cycle == 'daily' && $usersDateArray['date'] == Carbon::today()->addWeeks(1)->format('Y-m-d')); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -62,6 +62,9 @@ |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $date |
|
67 | + */ |
|
65 | 68 | private function pushToArray($list, array $columnName, $date) { |
66 | 69 | $array = []; |
67 | 70 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function __construct() |
17 | 17 | { |
18 | 18 | $this->start = Carbon::today()->subWeeks(1); |
19 | - $this->end = Carbon::today()->addMonths(2); |
|
19 | + $this->end = Carbon::today()->addMonths(2); |
|
20 | 20 | $this->calendarArray = []; |
21 | 21 | |
22 | 22 | $this->generateCalendarItems(); |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | $currentDate = $date->format('Y-m-d'); |
45 | 45 | |
46 | 46 | $separatedArray = $this->pushToArray($separatedList, ['destroyed_date'], $currentDate); |
47 | - $travelsArray = $this->pushToArray($travelList, ['leave_date','return_date'], $currentDate); |
|
47 | + $travelsArray = $this->pushToArray($travelList, ['leave_date', 'return_date'], $currentDate); |
|
48 | 48 | $trainingUsersArray = $this->pushToArray($trainingUsersList, ['due_date'], $currentDate); |
49 | 49 | $newUserArray = $this->pushToArray($newUserList, ['created_at'], $currentDate); |
50 | 50 | $trainingUsersArray = $this->groupUsersForTraining($trainingUsersArray); |
51 | 51 | |
52 | - if ( (!empty($separatedArray) || !empty($travelsArray) || !empty($trainingUsersArray) || !empty($newUserArray)) || $currentDate == Carbon::today()->format('Y-m-d') ) { |
|
52 | + if ((!empty($separatedArray) || !empty($travelsArray) || !empty($trainingUsersArray) || !empty($newUserArray)) || $currentDate == Carbon::today()->format('Y-m-d')) { |
|
53 | 53 | $this->calendarArray[$i]['date'] = $currentDate; |
54 | 54 | $this->calendarArray[$i]['separated'] = $separatedArray; |
55 | 55 | $this->calendarArray[$i]['travel'] = $travelsArray; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | - foreach($list as $item) { |
|
70 | + foreach ($list as $item) { |
|
71 | 71 | foreach ($columnName as $column) { |
72 | 72 | $dbDate = $this->testForCarbonObject($item[$column]); |
73 | 73 | if ($date == $dbDate) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | private function testForCarbonObject($date) |
87 | 87 | { |
88 | 88 | //check if format is YYYY-MM-DD |
89 | - if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$date)) { |
|
89 | + if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $date)) { |
|
90 | 90 | return $date; |
91 | 91 | } else if (get_class($date) == 'Carbon\Carbon') { |
92 | 92 | return $date->format('Y-m-d'); |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | private function groupUsersForTraining($trainingUsers) |
99 | 99 | { |
100 | 100 | $array = array(); |
101 | - foreach($trainingUsers as $key => $item) { |
|
101 | + foreach ($trainingUsers as $key => $item) { |
|
102 | 102 | $array[$item['training_id']][$key] = $item; |
103 | 103 | } |
104 | 104 | ksort($array, SORT_NUMERIC); |
105 | 105 | |
106 | - foreach($array as $training) { |
|
107 | - foreach($training as $trainingUser) { |
|
108 | - $trainingUser['userLink'] = "<a href='" . url('user', $trainingUser->user_id) ."'>". $trainingUser->user->userFullName ."</a>"; |
|
106 | + foreach ($array as $training) { |
|
107 | + foreach ($training as $trainingUser) { |
|
108 | + $trainingUser['userLink'] = "<a href='" . url('user', $trainingUser->user_id) . "'>" . $trainingUser->user->userFullName . "</a>"; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | */ |
118 | 118 | private function separatedList() |
119 | 119 | { |
120 | - return User::where( function ($q) { |
|
120 | + return User::where(function($q) { |
|
121 | 121 | $q->where('status', 'separated')->orWhere('status', 'destroyed'); |
122 | 122 | }) |
123 | - ->whereBetween('destroyed_date', [$this->start,$this->end]) |
|
123 | + ->whereBetween('destroyed_date', [$this->start, $this->end]) |
|
124 | 124 | ->get(); |
125 | 125 | } |
126 | 126 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | private function travelsList() |
131 | 131 | { |
132 | 132 | return Travel::with('user') |
133 | - ->where(function ($query) { |
|
133 | + ->where(function($query) { |
|
134 | 134 | $query->whereBetween('leave_date', [$this->start, $this->end]) |
135 | 135 | ->orWhereBetween('return_date', [$this->start, $this->end]); |
136 | 136 | }) |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * @param array $dateArray |
42 | 42 | * @param array $IDArray |
43 | - * @param $type |
|
43 | + * @param string $type |
|
44 | 44 | */ |
45 | 45 | public function processSwapRequest(array $dateArray, array $IDArray, $type) |
46 | 46 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Generate a collection to be used for emails. View is either emails.duty_future or emails.duty_today |
45 | - * @return mixed |
|
45 | + * @return \Illuminate\Support\Collection |
|
46 | 46 | */ |
47 | 47 | public function emailOutput() |
48 | 48 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Get function for the list. List is stored on the helper class. |
61 | - * @return mixed |
|
61 | + * @return Collection |
|
62 | 62 | */ |
63 | 63 | public function getList() |
64 | 64 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Get the current user in our database who is working the duty roster |
79 | - * @return mixed |
|
79 | + * @return DutyUsers |
|
80 | 80 | */ |
81 | 81 | public function getLastWorked() |
82 | 82 | { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Get a list of all users for a specific duty sorted by the user's last name |
90 | - * @return mixed |
|
90 | + * @return DutyUsers |
|
91 | 91 | */ |
92 | 92 | public function queryList() |
93 | 93 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Take our list of users and merge them with dates so that each user is assigned a duty date. |
100 | - * @return Collection |
|
100 | + * @return DutyUsers |
|
101 | 101 | */ |
102 | 102 | public function combineListWithDates() |
103 | 103 | { |
@@ -25,11 +25,11 @@ |
||
25 | 25 | $newCollection = new Collection(); |
26 | 26 | |
27 | 27 | foreach ($this->list as $entry) { |
28 | - if(Gate::allows('view')) { |
|
29 | - $rowvalue = "<a href='" . url( 'user', $entry['user']->id ) . "'>". $entry['user']->userFullName ."</a>"; |
|
30 | - } else { |
|
31 | - $rowvalue = $entry['user']->userFullName; |
|
32 | - } |
|
28 | + if(Gate::allows('view')) { |
|
29 | + $rowvalue = "<a href='" . url( 'user', $entry['user']->id ) . "'>". $entry['user']->userFullName ."</a>"; |
|
30 | + } else { |
|
31 | + $rowvalue = $entry['user']->userFullName; |
|
32 | + } |
|
33 | 33 | $newCollection->push([ |
34 | 34 | 'row' => $rowvalue, |
35 | 35 | 'id' => $entry['user']->id, |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $newCollection = new Collection(); |
26 | 26 | |
27 | 27 | foreach ($this->list as $entry) { |
28 | - if(Gate::allows('view')) { |
|
29 | - $rowvalue = "<a href='" . url( 'user', $entry['user']->id ) . "'>". $entry['user']->userFullName ."</a>"; |
|
28 | + if (Gate::allows('view')) { |
|
29 | + $rowvalue = "<a href='" . url('user', $entry['user']->id) . "'>" . $entry['user']->userFullName . "</a>"; |
|
30 | 30 | } else { |
31 | 31 | $rowvalue = $entry['user']->userFullName; |
32 | 32 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function emailOutput() |
48 | 48 | { |
49 | - $collection = $this->list->map(function ($value, $key) { |
|
49 | + $collection = $this->list->map(function($value, $key) { |
|
50 | 50 | return [ |
51 | 51 | 'users' => new Collection([$value['user']]), |
52 | 52 | 'date' => $value['date'], |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | ->orderBy('date', 'ASC') |
128 | 128 | ->get(); |
129 | 129 | |
130 | - foreach($dutySwaps as $swap) |
|
130 | + foreach ($dutySwaps as $swap) |
|
131 | 131 | { |
132 | - foreach($this->list as $key => $entry) |
|
132 | + foreach ($this->list as $key => $entry) |
|
133 | 133 | { |
134 | 134 | if ($swap->date == $entry['date']) { |
135 | 135 | $this->list[$key] = [ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Currently only called from the Training page via the sidebar upload. |
17 | 17 | * @param $request |
18 | - * @return Response |
|
18 | + * @return \Illuminate\Http\RedirectResponse |
|
19 | 19 | */ |
20 | 20 | public function store(Request $request) { |
21 | 21 | $data = $request->all(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Let the browser download the file. |
48 | 48 | * @param $fileId |
49 | - * @return mixed |
|
49 | + * @return Response |
|
50 | 50 | */ |
51 | 51 | public function show($fileId) |
52 | 52 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Remove the specified resource from storage. |
78 | 78 | * @param $fileId |
79 | - * @return Response |
|
79 | + * @return \Illuminate\Http\RedirectResponse |
|
80 | 80 | */ |
81 | 81 | public function destroy($fileId) |
82 | 82 | { |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | |
23 | 23 | $encrypt = false; |
24 | 24 | |
25 | - if( array_key_exists('encrypt', $data)) { |
|
25 | + if (array_key_exists('encrypt', $data)) { |
|
26 | 26 | $encrypt = $data['encrypt']; |
27 | 27 | } |
28 | 28 | |
29 | - if ($data['type'] == 'training'){ |
|
29 | + if ($data['type'] == 'training') { |
|
30 | 30 | $model = Training::findOrFail($data['id']); |
31 | 31 | } else if ($data['type'] == 'user') { |
32 | 32 | $model = User::findOrFail($data['id']); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $file = $modelName . "_" . $entry->imageable_id . '/' . $entry->filename; |
58 | 58 | |
59 | - if($entry->encrypted) { |
|
59 | + if ($entry->encrypted) { |
|
60 | 60 | try { |
61 | 61 | $fileContent = decrypt(Storage::get($file)); |
62 | 62 | } catch (DecryptException $e) { |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * Update the specified resource in storage. |
37 | 37 | * |
38 | 38 | * @param \Illuminate\Http\Request $request |
39 | - * @return \Illuminate\Http\Response |
|
39 | + * @return \Illuminate\Http\RedirectResponse |
|
40 | 40 | */ |
41 | 41 | public function update(Request $request) |
42 | 42 | { |