@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // persist the products |
| 88 | 88 | foreach ($request->products as $f => $product) { |
| 89 | - $productType = match ($product['type']) { |
|
| 89 | + $productType = match($product['type']) { |
|
| 90 | 90 | 'enrollment' => Enrollment::class, |
| 91 | 91 | 'scheduledPayment' => Enrollment::class, |
| 92 | 92 | 'fee' => Fee::class, |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | Payment::create([ |
| 156 | 156 | 'responsable_id' => backpack_user()->id, |
| 157 | 157 | 'invoice_id' => $invoice->id, |
| 158 | - 'payment_method' => isset($payment['method']) ? $payment['method'] : null , |
|
| 158 | + 'payment_method' => isset($payment['method']) ? $payment['method'] : null, |
|
| 159 | 159 | 'value' => $payment['value'], |
| 160 | 160 | 'date' => isset($payment['date']) ? Carbon::parse($payment['date']) : Carbon::now(), |
| 161 | 161 | ]); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | // if the sync with external mailing system is enabled |
| 20 | 20 | if (config('mailing-system.external_mailing_enabled') == true) { |
| 21 | 21 | |
| 22 | - match ($request->input('status')) { |
|
| 22 | + match($request->input('status')) { |
|
| 23 | 23 | 1 => $listId = config('mailing-system.mailerlite.activeStudentsListId'), |
| 24 | 24 | 2, 3 => $listId = config('mailing-system.mailerlite.inactiveStudentsListId'), |
| 25 | 25 | default => abort(422, 'List ID not found'), |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $report_end_date = $request->report_end_date ? Carbon::parse($request->report_end_date) : Carbon::parse($period->end); |
| 33 | 33 | |
| 34 | 34 | // if we are dealing with a complete period, add theoretical volumes |
| 35 | - if (! $request->report_start_date && ! $request->report_end_date) { |
|
| 35 | + if (!$request->report_start_date && !$request->report_end_date) { |
|
| 36 | 36 | // ensure the report end date is not before the end date to avoid inconsistent results. |
| 37 | 37 | $report_end_date = $report_start_date->max($report_end_date); |
| 38 | 38 | |
@@ -17,10 +17,9 @@ |
||
| 17 | 17 | public $firstname; |
| 18 | 18 | public $listId; |
| 19 | 19 | |
| 20 | - public function __construct(Student|Contact $user, $listId = null) |
|
| 20 | + public function __construct(Student | Contact $user, $listId = null) |
|
| 21 | 21 | { |
| 22 | - $listId = $listId ? $listId : |
|
| 23 | - $this->email = $user->email; |
|
| 22 | + $listId = $listId ? $listId : $this->email = $user->email; |
|
| 24 | 23 | $this->name = $user->firstname; |
| 25 | 24 | $this->lastname = $user->lastname; |
| 26 | 25 | $this->listId = $listId; |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function build() |
| 26 | 26 | { |
| 27 | - return $this->subject('Facturation ' . $this->data['partner_name'])->view('emails.external_courses_report'); |
|
| 27 | + return $this->subject('Facturation '.$this->data['partner_name'])->view('emails.external_courses_report'); |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | // foreach partner with an alert set for this day of month |
| 33 | 33 | foreach (Partner::where('send_report_on', Carbon::now()->day)->get() as $partner) { |
| 34 | 34 | // get all courses |
| 35 | - $courses = $partner->courses()->whereHas('events', function (Builder $query) use ($period_start, $period_end) { |
|
| 35 | + $courses = $partner->courses()->whereHas('events', function(Builder $query) use ($period_start, $period_end) { |
|
| 36 | 36 | $query->where('start', '>=', $period_start->toDateString())->where('end', '<=', $period_end->toDateString()); |
| 37 | 37 | }) |
| 38 | 38 | ->with('events')->withCount('events') |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $this->hideSensitiveRequestDetails(); |
| 22 | 22 | |
| 23 | - Telescope::filter(function (IncomingEntry $entry) { |
|
| 23 | + Telescope::filter(function(IncomingEntry $entry) { |
|
| 24 | 24 | if ($this->app->isLocal()) { |
| 25 | 25 | return true; |
| 26 | 26 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function gate() |
| 63 | 63 | { |
| 64 | - Gate::define('viewTelescope', function ($user = null) { |
|
| 64 | + Gate::define('viewTelescope', function($user = null) { |
|
| 65 | 65 | return backpack_user() && backpack_user()->email === config('app.admin_email'); |
| 66 | 66 | }); |
| 67 | 67 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function authenticate() : string |
| 27 | 27 | { |
| 28 | 28 | Log::info('launching API'); |
| 29 | - $response = Http::post(config('lms.apolearn.url') . '/auth.gettoken', [ |
|
| 29 | + $response = Http::post(config('lms.apolearn.url').'/auth.gettoken', [ |
|
| 30 | 30 | 'api_key' => $this->apiKey, |
| 31 | 31 | 'username' => config('lms.apolearn.username'), |
| 32 | 32 | 'password' => config('lms.apolearn.password'), |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function createUser(User $user, ?string $password = null) : void |
| 39 | 39 | { |
| 40 | - Log::info('checking if user exists for local ID ' . $user->id); |
|
| 40 | + Log::info('checking if user exists for local ID '.$user->id); |
|
| 41 | 41 | // first check if the user already exists (email) |
| 42 | - $response = Http::get(config('lms.apolearn.url') . "/users/getbyemail/$user->email", [ |
|
| 42 | + $response = Http::get(config('lms.apolearn.url')."/users/getbyemail/$user->email", [ |
|
| 43 | 43 | 'auth_token' => $this->token, |
| 44 | 44 | 'api_key' => $this->apiKey, |
| 45 | 45 | ]); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $data = Arr::add($data, 'password', $password); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $response = Http::post(config('lms.apolearn.url') . '/users', $data); |
|
| 66 | + $response = Http::post(config('lms.apolearn.url').'/users', $data); |
|
| 67 | 67 | |
| 68 | 68 | if ($this->actionSucceeded($response)) { |
| 69 | 69 | $user->update(['lms_id' => $response->json()['result']['id']]); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $data = Arr::add($data, 'password', $password); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $response = Http::put(config('lms.apolearn.url') . '/users/' . $user->lms_id, $data); |
|
| 94 | + $response = Http::put(config('lms.apolearn.url').'/users/'.$user->lms_id, $data); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | abort(422, 'This course already exists on the remote platform'); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - Log::info('pushing local course ' . $course->id . ' to API'); |
|
| 106 | - $response = Http::post(config('lms.apolearn.url') . '/classrooms', [ |
|
| 105 | + Log::info('pushing local course '.$course->id.' to API'); |
|
| 106 | + $response = Http::post(config('lms.apolearn.url').'/classrooms', [ |
|
| 107 | 107 | "name" => $course->name, |
| 108 | 108 | "shortname" => $course->shortname, |
| 109 | 109 | "description" => $course->description, |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $course->update(['lms_id' => $courseId]); |
| 122 | 122 | |
| 123 | 123 | // assign an admin to the new class |
| 124 | - $response = Http::post(config('lms.apolearn.url') . "/classrooms/addadmin/$courseId", [ |
|
| 124 | + $response = Http::post(config('lms.apolearn.url')."/classrooms/addadmin/$courseId", [ |
|
| 125 | 125 | 'user_id' => config('lms.apolearn.admin_user_id'), |
| 126 | 126 | 'auth_token' => $this->token, |
| 127 | 127 | 'api_key' => $this->apiKey, |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | $this->createCourse($course); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - Log::info('updating course with locale ID' . $course->id); |
|
| 141 | - $response = Http::put(config('lms.apolearn.url') . "/classrooms/$course->lms_id", [ |
|
| 140 | + Log::info('updating course with locale ID'.$course->id); |
|
| 141 | + $response = Http::put(config('lms.apolearn.url')."/classrooms/$course->lms_id", [ |
|
| 142 | 142 | "name" => $course->name, |
| 143 | 143 | "shortname" => $course->shortname, |
| 144 | 144 | "description" => $course->description, |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | Log::info('updating the course teacher'); |
| 155 | 155 | // ensure the teacher is up to date |
| 156 | - $response = Http::get(config('lms.apolearn.url') . "/classrooms/teachers/$course->lms_id", [ |
|
| 156 | + $response = Http::get(config('lms.apolearn.url')."/classrooms/teachers/$course->lms_id", [ |
|
| 157 | 157 | 'auth_token' => $this->token, |
| 158 | 158 | 'api_key' => $this->apiKey, |
| 159 | 159 | ]); |
| 160 | 160 | |
| 161 | 161 | if ($this->actionSucceeded($response)) { |
| 162 | 162 | $teachers = collect($response->json()['result']['users']); |
| 163 | - Log::info('found these teachers IDs on LMS:' . implode(', ', $teachers->pluck('id')->toArray())); |
|
| 163 | + Log::info('found these teachers IDs on LMS:'.implode(', ', $teachers->pluck('id')->toArray())); |
|
| 164 | 164 | |
| 165 | 165 | // if the course has no teacher, stop |
| 166 | 166 | if (!$course->teacher) { |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | } else { |
| 172 | 172 | // check if remote course teachers are still valid |
| 173 | 173 | foreach ($teachers as $teacher) { |
| 174 | - Log::info('comparing ' . $teacher['id'] . ' and ' . $course->teacher->user->lms_id); |
|
| 174 | + Log::info('comparing '.$teacher['id'].' and '.$course->teacher->user->lms_id); |
|
| 175 | 175 | if ($teacher['id'] !== $course->teacher->user->lms_id) { |
| 176 | - Log::info('Removing teacher ' . $teacher['id'] . ' from course'); |
|
| 176 | + Log::info('Removing teacher '.$teacher['id'].' from course'); |
|
| 177 | 177 | $this->removeTeacher($course->lms_id, $teacher['id']); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $this->createUser($student->user); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $response = Http::post(config('lms.apolearn.url') . "/classrooms/addstudent/$courseId", [ |
|
| 202 | + $response = Http::post(config('lms.apolearn.url')."/classrooms/addstudent/$courseId", [ |
|
| 203 | 203 | 'user_id' => $student->user->lms_id, |
| 204 | 204 | 'auth_token' => $this->token, |
| 205 | 205 | 'api_key' => $this->apiKey, |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($course->teacher_id) |
| 220 | 220 | { |
| 221 | 221 | // if the teacher doesn't exist on LMS, create them |
| 222 | - if (! $course->teacher->user->lms_id) { |
|
| 222 | + if (!$course->teacher->user->lms_id) { |
|
| 223 | 223 | Log::info('creating user now'); |
| 224 | 224 | $this->createUser($course->teacher->user); |
| 225 | 225 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | protected function removeTeacher($courseId, $teacherId): void |
| 238 | 238 | { |
| 239 | - Log::info('Removing teacher ' . $teacherId . ' from course ' . $courseId); |
|
| 239 | + Log::info('Removing teacher '.$teacherId.' from course '.$courseId); |
|
| 240 | 240 | $response = Http::put(config('lms.apolearn.url')."/classrooms/removeteacher/$courseId", [ |
| 241 | 241 | 'user_id' => $teacherId, |
| 242 | 242 | 'auth_token' => $this->token, |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | public function removeStudent($courseId, $userId): void |
| 251 | 251 | { |
| 252 | - Log::info('removing user id ' . $userId . ' from course ' . $courseId); |
|
| 252 | + Log::info('removing user id '.$userId.' from course '.$courseId); |
|
| 253 | 253 | $response = Http::put(config('lms.apolearn.url')."/classrooms/removestudent/$courseId", [ |
| 254 | 254 | 'user_id' => $userId, |
| 255 | 255 | 'auth_token' => $this->token, |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $subscriberGroups = $this->subscribersApi->getGroups($email); // returns array of group objects subscriber belongs to |
| 26 | 26 | |
| 27 | 27 | foreach ($subscriberGroups as $group) { |
| 28 | - $groupId = $array = json_decode(json_encode($group),true); |
|
| 28 | + $groupId = $array = json_decode(json_encode($group), true); |
|
| 29 | 29 | $this->groupsApi->removeSubscriber($groupId['id'], $email); // returns empty response |
| 30 | 30 | } |
| 31 | 31 | |