@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function scopeActiveUsers($query) |
| 51 | 51 | { |
| 52 | - return $query->whereHas('user', function ($q) { |
|
| 52 | + return $query->whereHas('user', function($q) { |
|
| 53 | 53 | $q->where('status', 'active'); |
| 54 | 54 | }); |
| 55 | 55 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function handle() |
| 29 | 29 | { |
| 30 | - if(config('auth.guards.web.provider') == 'adldap') { |
|
| 30 | + if (config('auth.guards.web.provider') == 'adldap') { |
|
| 31 | 31 | $this->addMissingUsers(); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | Mail::send( |
| 60 | 60 | 'emails.training', |
| 61 | 61 | ['user' => $user, 'training' => $training, 'due_date' => $dueDate, 'trainingUser' => $trainingUser], |
| 62 | - function ($m) use ($user, $training) { |
|
| 62 | + function($m) use ($user, $training) { |
|
| 63 | 63 | $m->to($user->email, $user->userFullName)->subject($training->name . " was assigned to you."); |
| 64 | 64 | |
| 65 | 65 | //ATTACH FILES |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | /** |
| 35 | 35 | * @var array |
| 36 | 36 | */ |
| 37 | - protected $hidden = array('username','password'); |
|
| 37 | + protected $hidden = array('username', 'password'); |
|
| 38 | 38 | |
| 39 | 39 | public function supervisor() |
| 40 | 40 | { |
@@ -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 | }) |
@@ -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] = [ |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct(Duty $duty) |
| 15 | 15 | { |
| 16 | - parent::__construct($duty);; |
|
| 16 | + parent::__construct($duty); ; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function HTMLOutput() |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function emailOutput() |
| 38 | 38 | { |
| 39 | - $collection = $this->list->map(function ($value, $key) { |
|
| 39 | + $collection = $this->list->map(function($value, $key) { |
|
| 40 | 40 | return [ |
| 41 | 41 | 'users' => $value['group'], |
| 42 | 42 | 'date' => $value['date'] |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $newList = new Collection(); |
| 72 | 72 | $count = $this->list->count(); |
| 73 | 73 | |
| 74 | - for ($i = 0; $i < $count ; $i++) |
|
| 74 | + for ($i = 0; $i < $count; $i++) |
|
| 75 | 75 | { |
| 76 | 76 | $newList->push([ |
| 77 | 77 | 'date' => $dates[$i], |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | ->orderBy('date', 'ASC') |
| 93 | 93 | ->get(); |
| 94 | 94 | |
| 95 | - foreach($dutySwaps as $swap) |
|
| 95 | + foreach ($dutySwaps as $swap) |
|
| 96 | 96 | { |
| 97 | - foreach($this->list as $key => $entry) |
|
| 97 | + foreach ($this->list as $key => $entry) |
|
| 98 | 98 | { |
| 99 | 99 | if ($swap->date == $entry['date']) { |
| 100 | 100 | $this->list[$key] = [ |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $row = ''; |
| 117 | 117 | foreach ($entry['group'] as $user) { |
| 118 | - if(Gate::allows('view')) { |
|
| 118 | + if (Gate::allows('view')) { |
|
| 119 | 119 | $row .= "<a href='" . url('user', $user->id) . "'>" . $user->userFullName . "</a> & "; |
| 120 | 120 | } else { |
| 121 | 121 | $row .= $user->userFullName . " & "; |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | if ($cycle == 'monthly') { |
| 42 | 42 | return Carbon::now()->startOfMonth(); |
| 43 | - }else if($cycle == 'weekly') { |
|
| 43 | + } else if ($cycle == 'weekly') { |
|
| 44 | 44 | return Carbon::now()->startOfWeek(); |
| 45 | - }else if($cycle == 'daily') { |
|
| 45 | + } else if ($cycle == 'daily') { |
|
| 46 | 46 | return Carbon::now()->startOfDay(); |
| 47 | 47 | } else { |
| 48 | 48 | Log::error('Duty has an invalid cycle name. Must use monthly, weekly or daily'); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | if ($cycle == 'monthly') { |
| 56 | 56 | return $date->addMonth(); |
| 57 | - }else if($cycle == 'weekly') { |
|
| 57 | + } else if ($cycle == 'weekly') { |
|
| 58 | 58 | return $date->addWeek(); |
| 59 | - }else if($cycle == 'daily') { |
|
| 59 | + } else if ($cycle == 'daily') { |
|
| 60 | 60 | return $date->addDay(); |
| 61 | 61 | } else { |
| 62 | 62 | Log::error('Duty has an invalid cycle name. Must use monthly, weekly or daily'); |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | if ($cycle == 'monthly') { |
| 42 | 42 | return Carbon::now()->startOfMonth(); |
| 43 | - }else if($cycle == 'weekly') { |
|
| 43 | + } else if($cycle == 'weekly') { |
|
| 44 | 44 | return Carbon::now()->startOfWeek(); |
| 45 | - }else if($cycle == 'daily') { |
|
| 45 | + } else if($cycle == 'daily') { |
|
| 46 | 46 | return Carbon::now()->startOfDay(); |
| 47 | 47 | } else { |
| 48 | 48 | Log::error('Duty has an invalid cycle name. Must use monthly, weekly or daily'); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | if ($cycle == 'monthly') { |
| 56 | 56 | return $date->addMonth(); |
| 57 | - }else if($cycle == 'weekly') { |
|
| 57 | + } else if($cycle == 'weekly') { |
|
| 58 | 58 | return $date->addWeek(); |
| 59 | - }else if($cycle == 'daily') { |
|
| 59 | + } else if($cycle == 'daily') { |
|
| 60 | 60 | return $date->addDay(); |
| 61 | 61 | } else { |
| 62 | 62 | Log::error('Duty has an invalid cycle name. Must use monthly, weekly or daily'); |
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function handle($export) |
| 12 | 12 | { |
| 13 | - return $export->sheet('User-Training', function ($sheet) { |
|
| 13 | + return $export->sheet('User-Training', function($sheet) { |
|
| 14 | 14 | |
| 15 | 15 | $trainings = Training::all(); |
| 16 | 16 | $users = User::skipSystem()->with([ |
| 17 | - 'assignedTrainings' => function ($q) { |
|
| 17 | + 'assignedTrainings' => function($q) { |
|
| 18 | 18 | $q->whereNotNull('completed_date')->orderBy('completed_date', 'desc'); |
| 19 | 19 | } |
| 20 | 20 | ])->active()->orderBy('last_name')->get(); |