@@ -80,41 +80,41 @@ |
||
| 80 | 80 | $this->count += 1; |
| 81 | 81 | $this->student = $approvedstudent ; |
| 82 | 82 | try{ |
| 83 | - Institution_student::insert([ |
|
| 84 | - 'student_status_id' => 1, |
|
| 85 | - 'student_id' => $approvedstudent['student_id'], |
|
| 86 | - 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
| 87 | - 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
| 88 | - 'start_date' => $approvedstudent['start_date'], |
|
| 89 | - 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
| 90 | - 'end_date' => $approvedstudent['end_date'], |
|
| 91 | - 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
| 92 | - 'institution_id' => $approvedstudent['institution_id'], |
|
| 93 | - 'admission_id' => $approvedstudent['admission_id'], |
|
| 94 | - 'created_user_id' => $approvedstudent['created_user_id'], |
|
| 95 | - ]); |
|
| 83 | + Institution_student::insert([ |
|
| 84 | + 'student_status_id' => 1, |
|
| 85 | + 'student_id' => $approvedstudent['student_id'], |
|
| 86 | + 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
| 87 | + 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
| 88 | + 'start_date' => $approvedstudent['start_date'], |
|
| 89 | + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
| 90 | + 'end_date' => $approvedstudent['end_date'], |
|
| 91 | + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
| 92 | + 'institution_id' => $approvedstudent['institution_id'], |
|
| 93 | + 'admission_id' => $approvedstudent['admission_id'], |
|
| 94 | + 'created_user_id' => $approvedstudent['created_user_id'], |
|
| 95 | + ]); |
|
| 96 | 96 | |
| 97 | - if(!is_null($approvedstudent['institution_class_id'])){ |
|
| 98 | - Institution_class_student::insert([ |
|
| 99 | - 'student_id' => $approvedstudent['student_id'], |
|
| 100 | - 'institution_class_id' => $approvedstudent['institution_class_id'], |
|
| 101 | - 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
| 102 | - 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
| 103 | - 'institution_id' =>$approvedstudent['institution_id'], |
|
| 104 | - 'student_status_id' => 1, |
|
| 105 | - 'created_user_id' => $approvedstudent['created_user_id'], |
|
| 106 | - ]); |
|
| 107 | - } |
|
| 97 | + if(!is_null($approvedstudent['institution_class_id'])){ |
|
| 98 | + Institution_class_student::insert([ |
|
| 99 | + 'student_id' => $approvedstudent['student_id'], |
|
| 100 | + 'institution_class_id' => $approvedstudent['institution_class_id'], |
|
| 101 | + 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
| 102 | + 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
| 103 | + 'institution_id' =>$approvedstudent['institution_id'], |
|
| 104 | + 'student_status_id' => 1, |
|
| 105 | + 'created_user_id' => $approvedstudent['created_user_id'], |
|
| 106 | + ]); |
|
| 107 | + } |
|
| 108 | 108 | $output->writeln(' |
| 109 | 109 | #################################################### |
| 110 | 110 | Total number of students updated : '.$this->count.' |
| 111 | 111 | # # |
| 112 | 112 | ####################################################' ); |
| 113 | 113 | // $output->writeln(); |
| 114 | - }catch (\Exception $e){ |
|
| 114 | + }catch (\Exception $e){ |
|
| 115 | 115 | // echo $e->getMessage(); |
| 116 | - $output->writeln( $e->getMessage()); |
|
| 117 | - } |
|
| 116 | + $output->writeln( $e->getMessage()); |
|
| 117 | + } |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | } |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | 'id' => $this->argument('institution') |
| 49 | 49 | ])->first(); |
| 50 | 50 | |
| 51 | - if(!is_null($institution)){ |
|
| 51 | + if (!is_null($institution)) { |
|
| 52 | 52 | |
| 53 | 53 | // dd($institution); |
| 54 | 54 | try { |
| 55 | - $this->info('adding missing students to the institution ' . $institution->name); |
|
| 55 | + $this->info('adding missing students to the institution '.$institution->name); |
|
| 56 | 56 | $approvedstudent = Institution_student_admission::select('institution_student_admission.*')->join('institutions', 'institution_id', '=', 'institutions.id')->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id')->where([ |
| 57 | 57 | // 'status_id' => 121,122,123,124, // |
| 58 | 58 | 'institution_id' => $institution->id |
@@ -67,34 +67,34 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - protected function addStudents($approvedstudent){ |
|
| 71 | - array_walk($approvedstudent,array($this,'addStudent')); |
|
| 70 | + protected function addStudents($approvedstudent) { |
|
| 71 | + array_walk($approvedstudent, array($this, 'addStudent')); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function addStudent($approvedstudent){ |
|
| 74 | + protected function addStudent($approvedstudent) { |
|
| 75 | 75 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 76 | 76 | Log::info($approvedstudent); |
| 77 | 77 | |
| 78 | 78 | sleep(1); |
| 79 | - if(!(Institution_student::isDuplicated($approvedstudent) > 0)){ |
|
| 79 | + if (!(Institution_student::isDuplicated($approvedstudent) > 0)) { |
|
| 80 | 80 | $this->count += 1; |
| 81 | - $this->student = $approvedstudent ; |
|
| 82 | - try{ |
|
| 81 | + $this->student = $approvedstudent; |
|
| 82 | + try { |
|
| 83 | 83 | Institution_student::insert([ |
| 84 | 84 | 'student_status_id' => 1, |
| 85 | 85 | 'student_id' => $approvedstudent['student_id'], |
| 86 | 86 | 'education_grade_id' => $approvedstudent['education_grade_id'], |
| 87 | 87 | 'academic_period_id' => $approvedstudent['academic_period_id'], |
| 88 | 88 | 'start_date' => $approvedstudent['start_date'], |
| 89 | - 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
| 89 | + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year, // $approvedstudent['start_date']->format('Y'), |
|
| 90 | 90 | 'end_date' => $approvedstudent['end_date'], |
| 91 | - 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
| 91 | + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year, //$approvedstudent['end_date']->format('Y'), |
|
| 92 | 92 | 'institution_id' => $approvedstudent['institution_id'], |
| 93 | 93 | 'admission_id' => $approvedstudent['admission_id'], |
| 94 | 94 | 'created_user_id' => $approvedstudent['created_user_id'], |
| 95 | 95 | ]); |
| 96 | 96 | |
| 97 | - if(!is_null($approvedstudent['institution_class_id'])){ |
|
| 97 | + if (!is_null($approvedstudent['institution_class_id'])) { |
|
| 98 | 98 | Institution_class_student::insert([ |
| 99 | 99 | 'student_id' => $approvedstudent['student_id'], |
| 100 | 100 | 'institution_class_id' => $approvedstudent['institution_class_id'], |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | # # |
| 112 | 112 | ####################################################' ); |
| 113 | 113 | // $output->writeln(); |
| 114 | - }catch (\Exception $e){ |
|
| 114 | + }catch (\Exception $e) { |
|
| 115 | 115 | // echo $e->getMessage(); |
| 116 | - $output->writeln( $e->getMessage()); |
|
| 116 | + $output->writeln($e->getMessage()); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | dd($approvedstudent); |
| 61 | 61 | $approvedstudent = array_chunk($approvedstudent, 50); |
| 62 | 62 | array_walk($approvedstudent, array($this, 'addStudents')); |
| 63 | - }catch (\Exception $e) { |
|
| 63 | + } catch (\Exception $e) { |
|
| 64 | 64 | Log::error($e); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | # # |
| 112 | 112 | ####################################################' ); |
| 113 | 113 | // $output->writeln(); |
| 114 | - }catch (\Exception $e){ |
|
| 114 | + } catch (\Exception $e){ |
|
| 115 | 115 | // echo $e->getMessage(); |
| 116 | 116 | $output->writeln( $e->getMessage()); |
| 117 | 117 | } |