@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | use Webpatser\Uuid\Uuid; |
7 | 7 | |
8 | -class Institution_class_subject extends Base_Model { |
|
8 | +class Institution_class_subject extends Base_Model { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * The database table used by the model. |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | */ |
43 | 43 | protected $dates = ['modified', 'created']; |
44 | 44 | |
45 | - public function institutionMandatorySubject(){ |
|
46 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
45 | + public function institutionMandatorySubject() { |
|
46 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
47 | 47 | ->with('institutionGradeSubject') |
48 | - ->whereHas('institutionGradeSubject', function ($query) { |
|
49 | - $query->where('auto_allocation',1); |
|
48 | + ->whereHas('institutionGradeSubject', function($query) { |
|
49 | + $query->where('auto_allocation', 1); |
|
50 | 50 | }); |
51 | 51 | } |
52 | 52 | |
53 | - public function institutionOptionalSubject(){ |
|
54 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
53 | + public function institutionOptionalSubject() { |
|
54 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
55 | 55 | ->with('institutionGradeSubject') |
56 | - ->whereHas('institutionGradeSubject', function ($query) { |
|
57 | - $query->where('auto_allocation',0); |
|
56 | + ->whereHas('institutionGradeSubject', function($query) { |
|
57 | + $query->where('auto_allocation', 0); |
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | } |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | public static function boot() |
63 | 63 | { |
64 | 64 | parent::boot(); |
65 | - self::creating(function ($model) { |
|
65 | + self::creating(function($model) { |
|
66 | 66 | $model->id = (string) Uuid::generate(4); |
67 | 67 | }); |
68 | 68 | } |
69 | 69 | |
70 | - public function institutionSubject(){ |
|
71 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
70 | + public function institutionSubject() { |
|
71 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
72 | 72 | ->with('institutionGradeSubject'); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - public static function getMandetorySubjects($institutionClass){ |
|
76 | + public static function getMandetorySubjects($institutionClass) { |
|
77 | 77 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first(); |
78 | 78 | $mandatorySubject = Institution_class_subject::with(['institutionSubject']) |
79 | - ->whereHas('institutionSubject', function ($query) use ($institutionGrade) { |
|
80 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
81 | - $query->where('auto_allocation',1); |
|
79 | + ->whereHas('institutionSubject', function($query) use ($institutionGrade) { |
|
80 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
81 | + $query->where('auto_allocation', 1); |
|
82 | 82 | })->where('education_grade_id', $institutionGrade->education_grade_id); |
83 | 83 | // ->where('auto_allocation', $institutionGrade->education_grade_id); |
84 | 84 | }) |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | return $mandatorySubject; |
88 | 88 | } |
89 | 89 | |
90 | - public static function getAllSubjects($institutionClass){ |
|
90 | + public static function getAllSubjects($institutionClass) { |
|
91 | 91 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first(); |
92 | 92 | $allSubjects = Institution_class_subject::with(['institutionSubject']) |
93 | - ->whereHas('institutionSubject', function ($query) use ($institutionGrade) { |
|
93 | + ->whereHas('institutionSubject', function($query) use ($institutionGrade) { |
|
94 | 94 | $query->whereHas('institutionGradeSubject')->where('education_grade_id', $institutionGrade->education_grade_id); |
95 | 95 | }) |
96 | 96 | ->where('institution_class_id', '=', $institutionClass) |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | $data = []; |
103 | 103 | foreach ($subjects as $subject) { |
104 | 104 | $subjectId = Institution_class_subject::with(['institutionSubject']) |
105 | - ->whereHas('institutionSubject', function ($query) use ($row, $subject, $student) { |
|
106 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
107 | - $query->where('auto_allocation',0); |
|
105 | + ->whereHas('institutionSubject', function($query) use ($row, $subject, $student) { |
|
106 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
107 | + $query->where('auto_allocation', 0); |
|
108 | 108 | }) |
109 | 109 | ->where('name', '=', $row[$subject]) |
110 | 110 | ->where('education_grade_id', '=', $student->education_grade_id); |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | return $data; |
118 | 118 | } |
119 | 119 | |
120 | - public function getInstitutionClassSubjects($academicPeriodId,$classIds){ |
|
120 | + public function getInstitutionClassSubjects($academicPeriodId, $classIds) { |
|
121 | 121 | return self::query() |
122 | - ->whereIn('institution_class_id',$classIds) |
|
122 | + ->whereIn('institution_class_id', $classIds) |
|
123 | 123 | ->get() |
124 | 124 | ->toArray(); |
125 | 125 | } |
126 | 126 | |
127 | - public function isDuplicated($subject){ |
|
128 | - return self::query()->where('institution_subject_id',$subject['institution_subject_id']) |
|
129 | - ->where('institution_class_id',$subject['institution_class_id'])->get()->toArray(); |
|
127 | + public function isDuplicated($subject) { |
|
128 | + return self::query()->where('institution_subject_id', $subject['institution_subject_id']) |
|
129 | + ->where('institution_class_id', $subject['institution_class_id'])->get()->toArray(); |
|
130 | 130 | } |
131 | 131 | } |
@@ -67,13 +67,13 @@ |
||
67 | 67 | 'institution_id' => $admissionInfo['instituion']->id, |
68 | 68 | 'academic_period_id' => $admissionInfo['academic_period']->id, |
69 | 69 | 'education_grade_id' => $admissionInfo['education_grade']->id, |
70 | - 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class'])==1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
70 | + 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class']) == 1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
71 | 71 | 'comment' => 'Imported From Examination Data', |
72 | 72 | 'updated_from' => 'doe', |
73 | 73 | 'created_user_id' => 1 |
74 | 74 | ]; |
75 | 75 | self::create($data); |
76 | - } catch (\Throwable $th) { |
|
76 | + }catch (\Throwable $th) { |
|
77 | 77 | Log::error($th); |
78 | 78 | } |
79 | 79 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($user) |
22 | 22 | { |
23 | - $this->user = $user; |
|
23 | + $this->user = $user; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -41,10 +41,10 @@ |
||
41 | 41 | { |
42 | 42 | $year = $this->argument('year'); |
43 | 43 | $institutions = $this->instituion_grade->getInstitutionGradeList($year); |
44 | - array_walk($institutions,array($this,'callPromotion'),$year); |
|
44 | + array_walk($institutions, array($this, 'callPromotion'), $year); |
|
45 | 45 | } |
46 | 46 | |
47 | - protected function callPromotion($institution,$count,$year){ |
|
48 | - $this->call('promote:students',['year' => $year,'institution' => $institution['code']]); |
|
47 | + protected function callPromotion($institution, $count, $year) { |
|
48 | + $this->call('promote:students', ['year' => $year, 'institution' => $institution['code']]); |
|
49 | 49 | } |
50 | 50 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | $year = $this->argument('year'); |
63 | 63 | $institution = $this->argument('institution'); |
64 | - $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($year,$institution); |
|
65 | - (new BulkPromotion())->callback($institutionGrade,$year); |
|
64 | + $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($year, $institution); |
|
65 | + (new BulkPromotion())->callback($institutionGrade, $year); |
|
66 | 66 | } |
67 | 67 | } |
@@ -52,9 +52,9 @@ |
||
52 | 52 | 'academic_period' => $academicPeriod |
53 | 53 | ]; |
54 | 54 | |
55 | - if($year <= 2019){ |
|
55 | + if ($year <= 2019) { |
|
56 | 56 | die('Academic Year 2019 or earlier can`t be deleted'); |
57 | - }else{ |
|
57 | + }else { |
|
58 | 58 | $this->clone->cleanConfig($params); |
59 | 59 | } |
60 | 60 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $output->writeln('###########################################------starting export------###########################################'); |
48 | 48 | $this->examinationController->export(); |
49 | 49 | $output->writeln('###########################################------Finished inserting file records------###########################################'); |
50 | - } else { |
|
50 | + }else { |
|
51 | 51 | $this->examinationController->doMatch($this->argument('offset'), $this->argument('limit'), $this->argument(('mode'))); |
52 | 52 | $this->examinationController->export(); |
53 | 53 | } |
@@ -44,21 +44,21 @@ |
||
44 | 44 | $this->start_time = microtime(TRUE); |
45 | 45 | $count = DB::table('examination_students')->select('nsid')->distinct()->count(); |
46 | 46 | $this->examinationController = new ExaminationStudentsController($this->argument('year'), $this->argument('grade')); |
47 | - $studentsIdsWithDuplication = DB::table('examination_students as es') |
|
48 | - ->select(DB::raw('count(*) as total'),'es.*') |
|
47 | + $studentsIdsWithDuplication = DB::table('examination_students as es') |
|
48 | + ->select(DB::raw('count(*) as total'), 'es.*') |
|
49 | 49 | ->whereNotNull('es.nsid') |
50 | - ->having('total','>',1) |
|
50 | + ->having('total', '>', 1) |
|
51 | 51 | ->groupBy('es.nsid') |
52 | 52 | ->orderBy('es.nsid') |
53 | - ->chunk($this->argument('limit'),function($Students){ |
|
53 | + ->chunk($this->argument('limit'), function($Students) { |
|
54 | 54 | foreach ($Students as $Student) { |
55 | - $count = Examination_student::where('nsid',$Student->nsid)->count(); |
|
56 | - if($count> 1){ |
|
57 | - Examination_student::where('nsid',$Student->nsid)->update(['nsid'=>'']); |
|
55 | + $count = Examination_student::where('nsid', $Student->nsid)->count(); |
|
56 | + if ($count > 1) { |
|
57 | + Examination_student::where('nsid', $Student->nsid)->update(['nsid'=>'']); |
|
58 | 58 | $students = (array) json_decode(json_encode($Students), true); |
59 | 59 | array_walk($students, array($this->examinationController, 'clone')); |
60 | 60 | } |
61 | - $this->output->writeln($Student->nsid .'same ID' . $count . ' records removed'); |
|
61 | + $this->output->writeln($Student->nsid.'same ID'.$count.' records removed'); |
|
62 | 62 | } |
63 | 63 | }); |
64 | 64 | } |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | $this->academic_period = new Academic_period(); |
29 | 29 | $this->institution_classes = new Institution_class(); |
30 | 30 | $this->institution_class_subjects = new Institution_class_subject(); |
31 | - $this->institution_subjects = new Institution_subject(); |
|
32 | - $this->education_grade_subjects = new Education_grades_subject(); |
|
31 | + $this->institution_subjects = new Institution_subject(); |
|
32 | + $this->education_grade_subjects = new Education_grades_subject(); |
|
33 | 33 | $this->output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | - public function array_walk($shift,$count,$params){ |
|
38 | - array_walk($shift,array($this,'process'),$params); |
|
37 | + public function array_walk($shift, $count, $params) { |
|
38 | + array_walk($shift, array($this, 'process'), $params); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function cleanConfig($params){ |
|
41 | + public function cleanConfig($params) { |
|
42 | 42 | $academicPeriod = $params['academic_period']; |
43 | 43 | $this->shifts->where(['academic_period_id' => $academicPeriod->id])->delete(); |
44 | 44 | $this->output->writeln('cleaned shifts'); |
@@ -46,32 +46,32 @@ discard block |
||
46 | 46 | $this->shifts->where(['cloned' => $academicPeriod->code])->update(['cloned' => $academicPeriod->code - 1]); |
47 | 47 | $this->output->writeln('updated shifts'); |
48 | 48 | |
49 | - $classIds = $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray(); |
|
49 | + $classIds = $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray(); |
|
50 | 50 | $this->institution_classes->where(['academic_period_id' => $academicPeriod->id])->delete(); |
51 | 51 | $this->output->writeln('cleaned classes'); |
52 | 52 | |
53 | - $this->institution_class_subjects->whereNotIn( 'institution_class_id' , $classIds)->delete(); |
|
53 | + $this->institution_class_subjects->whereNotIn('institution_class_id', $classIds)->delete(); |
|
54 | 54 | $this->output->writeln('cleaned subjects'); |
55 | 55 | |
56 | - do{ |
|
57 | - $deleted = $this->institution_subjects->where('academic_period_id',$academicPeriod->id)->limit(100000)->delete(); |
|
56 | + do { |
|
57 | + $deleted = $this->institution_subjects->where('academic_period_id', $academicPeriod->id)->limit(100000)->delete(); |
|
58 | 58 | $this->output->writeln('100000 institutions cleaned shifts'); |
59 | - }while($deleted > 0); |
|
59 | + } while ($deleted > 0); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process($shift,$count,$params){ |
|
63 | - echo('['.getmypid().']This Process executed at'.date("F d, Y h:i:s A")."\n") ; |
|
62 | + public function process($shift, $count, $params) { |
|
63 | + echo('['.getmypid().']This Process executed at'.date("F d, Y h:i:s A")."\n"); |
|
64 | 64 | $year = $params['year']; |
65 | 65 | $academicPeriod = $params['academic_period']; |
66 | 66 | $previousAcademicPeriod = $params['previous_academic_period']; |
67 | - try{ |
|
67 | + try { |
|
68 | 68 | $shiftId = $this->updateShifts($year, $shift); |
69 | 69 | $institutionClasses = $this->institution_classes->getShiftClasses($shift['id']); |
70 | - $institutionSubjects = $this->institution_subjects->getInstitutionSubjects($shift['institution_id'],$previousAcademicPeriod->id); |
|
71 | - array_walk($institutionSubjects , array($this,'insertInstitutionSubjects'),$academicPeriod); |
|
72 | - if (!empty($institutionClasses) && !is_null($shiftId) && !is_null($academicPeriod) ) { |
|
70 | + $institutionSubjects = $this->institution_subjects->getInstitutionSubjects($shift['institution_id'], $previousAcademicPeriod->id); |
|
71 | + array_walk($institutionSubjects, array($this, 'insertInstitutionSubjects'), $academicPeriod); |
|
72 | + if (!empty($institutionClasses) && !is_null($shiftId) && !is_null($academicPeriod)) { |
|
73 | 73 | |
74 | - $newInstitutionClasses = $this->generateNewClass($institutionClasses,$shiftId,$academicPeriod->id); |
|
74 | + $newInstitutionClasses = $this->generateNewClass($institutionClasses, $shiftId, $academicPeriod->id); |
|
75 | 75 | |
76 | 76 | $params = [ |
77 | 77 | 'previous_academic_period_id' => $previousAcademicPeriod->id, |
@@ -79,21 +79,21 @@ discard block |
||
79 | 79 | 'shift_id' =>$shiftId |
80 | 80 | ]; |
81 | 81 | |
82 | - try{ |
|
83 | - array_walk($newInstitutionClasses,array($this,'insertInstitutionClasses'),$params); |
|
82 | + try { |
|
83 | + array_walk($newInstitutionClasses, array($this, 'insertInstitutionClasses'), $params); |
|
84 | 84 | $newInstitutionClasses = $this->institution_classes->getShiftClasses($shiftId); |
85 | 85 | $this->output->writeln('##########################################################################################################################'); |
86 | - $this->output->writeln('updating from '. $shiftId); |
|
86 | + $this->output->writeln('updating from '.$shiftId); |
|
87 | 87 | |
88 | - }catch (\Exception $e){ |
|
88 | + }catch (\Exception $e) { |
|
89 | 89 | dd($e); |
90 | - Log::error($e->getMessage(),[$e]); |
|
90 | + Log::error($e->getMessage(), [$e]); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | // DB::commit(); |
94 | - }catch (\Exception $e){ |
|
94 | + }catch (\Exception $e) { |
|
95 | 95 | // DB::rollBack(); |
96 | - Log::error($e->getMessage(),[$e]); |
|
96 | + Log::error($e->getMessage(), [$e]); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -103,31 +103,31 @@ discard block |
||
103 | 103 | * @param $count |
104 | 104 | * @param $academicPeriod |
105 | 105 | */ |
106 | - public function insertInstitutionSubjects($subjects, $count,$academicPeriod){ |
|
107 | - try{ |
|
106 | + public function insertInstitutionSubjects($subjects, $count, $academicPeriod) { |
|
107 | + try { |
|
108 | 108 | $subjects['academic_period_id'] = $academicPeriod->id; |
109 | 109 | $subjects['created'] = now(); |
110 | 110 | unset($subjects['total_male_students']); |
111 | 111 | unset($subjects['total_female_students']); |
112 | 112 | unset($subjects['id']); |
113 | 113 | $this->institution_subjects->create($subjects); |
114 | - }catch (\Exception $e){ |
|
115 | - Log::error($e->getMessage(),[$e]); |
|
114 | + }catch (\Exception $e) { |
|
115 | + Log::error($e->getMessage(), [$e]); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - public function insertInstitutionClasses($class,$count,$param){ |
|
121 | - try{ |
|
120 | + public function insertInstitutionClasses($class, $count, $param) { |
|
121 | + try { |
|
122 | 122 | |
123 | 123 | $academicPeriod = $param['academic_period_id']; |
124 | 124 | $educationGrdae = $class['education_grade_id']; |
125 | 125 | |
126 | 126 | $classId = $class['id']; |
127 | 127 | unset($class['id']); |
128 | - $institutionSubjects = Institution_subject::query()->where('education_grade_id',$class['education_grade_id']) |
|
129 | - ->where('institution_id',$class['institution_id']) |
|
130 | - ->where('academic_period_id',$academicPeriod)->get()->toArray(); |
|
128 | + $institutionSubjects = Institution_subject::query()->where('education_grade_id', $class['education_grade_id']) |
|
129 | + ->where('institution_id', $class['institution_id']) |
|
130 | + ->where('academic_period_id', $academicPeriod)->get()->toArray(); |
|
131 | 131 | $params = [ |
132 | 132 | 'class'=>$class, |
133 | 133 | 'subjects'=>$institutionSubjects, |
@@ -140,39 +140,39 @@ discard block |
||
140 | 140 | $class['no_of_students'] = $noOfStudents; |
141 | 141 | $class['created'] = now(); |
142 | 142 | $class['institution_shift_id'] = $param['shift_id']; |
143 | - $this->output->writeln('Create class:'. $class['name']); |
|
143 | + $this->output->writeln('Create class:'.$class['name']); |
|
144 | 144 | $class = Institution_class::create($class); |
145 | 145 | $institutionClassGrdaeObj['institution_class_id'] = $class->id; |
146 | 146 | $institutionClassGrdaeObj['education_grade_id'] = $educationGrdae; |
147 | 147 | Institution_class_grade::create($institutionClassGrdaeObj); |
148 | - $institutionSubjects = Institution_subject::query()->where('education_grade_id',$educationGrdae) |
|
149 | - ->where('institution_id',$class->institution_id) |
|
150 | - ->where('academic_period_id',$academicPeriod) |
|
148 | + $institutionSubjects = Institution_subject::query()->where('education_grade_id', $educationGrdae) |
|
149 | + ->where('institution_id', $class->institution_id) |
|
150 | + ->where('academic_period_id', $academicPeriod) |
|
151 | 151 | ->groupBy('education_subject_id') |
152 | 152 | ->get() |
153 | 153 | ->toArray(); |
154 | 154 | $params['class'] = $class; |
155 | - $this->insertInstitutionClassSubjects($institutionSubjects,$class); |
|
155 | + $this->insertInstitutionClassSubjects($institutionSubjects, $class); |
|
156 | 156 | // array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params); |
157 | - }catch (\Exception $e){ |
|
158 | - Log::error($e->getMessage(),[$e]); |
|
157 | + }catch (\Exception $e) { |
|
158 | + Log::error($e->getMessage(), [$e]); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - public function insertInstitutionClassSubjects($subjects,$class){ |
|
163 | - if(!empty($subjects)){ |
|
164 | - try{ |
|
165 | - array_walk($subjects,array($this,'insertClassSubjects'),$class); |
|
166 | - $this->output->writeln('updating subjects '. $class->name); |
|
167 | - }catch (\Exception $e){ |
|
168 | - Log::error($e->getMessage(),[$e]); |
|
162 | + public function insertInstitutionClassSubjects($subjects, $class) { |
|
163 | + if (!empty($subjects)) { |
|
164 | + try { |
|
165 | + array_walk($subjects, array($this, 'insertClassSubjects'), $class); |
|
166 | + $this->output->writeln('updating subjects '.$class->name); |
|
167 | + }catch (\Exception $e) { |
|
168 | + Log::error($e->getMessage(), [$e]); |
|
169 | 169 | } |
170 | 170 | }; |
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | - public function insertClassSubjects($subject,$count,$newClassId){ |
|
175 | - try{ |
|
174 | + public function insertClassSubjects($subject, $count, $newClassId) { |
|
175 | + try { |
|
176 | 176 | $subjectobj['status'] = 1; |
177 | 177 | $subjectobj['created_user_id'] = 1; |
178 | 178 | $subjectobj['created'] = now(); |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | $subjectobj['institution_class_id'] = $newClassId->id; |
181 | 181 | $subjectobj['institution_subject_id'] = $subject['id']; |
182 | 182 | |
183 | - if(!$this->institution_class_subjects->isDuplicated($subjectobj)){ |
|
183 | + if (!$this->institution_class_subjects->isDuplicated($subjectobj)) { |
|
184 | 184 | $this->institution_class_subjects->create($subjectobj); |
185 | 185 | } |
186 | - }catch (\Exception $e){ |
|
187 | - Log::error($e->getMessage(),[$e]); |
|
186 | + }catch (\Exception $e) { |
|
187 | + Log::error($e->getMessage(), [$e]); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | * @param $academicPeriod |
197 | 197 | * @return array |
198 | 198 | */ |
199 | - public function generateNewClass($classes,$shiftId,$academicPeriod){ |
|
199 | + public function generateNewClass($classes, $shiftId, $academicPeriod) { |
|
200 | 200 | $newClasses = []; |
201 | - foreach ( $classes as $class) { |
|
201 | + foreach ($classes as $class) { |
|
202 | 202 | $noOfStudents = $class['no_of_students'] == 0 ? 40 : $class['no_of_students']; |
203 | 203 | $class['academic_period_id'] = $academicPeriod; |
204 | 204 | $class['no_of_students'] = $noOfStudents; |
205 | 205 | $class['created'] = now(); |
206 | 206 | $class['institution_shift_id'] = $shiftId; |
207 | - array_push($newClasses,$class); |
|
207 | + array_push($newClasses, $class); |
|
208 | 208 | } |
209 | 209 | return $newClasses; |
210 | 210 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * @param $shift |
216 | 216 | * @return mixed |
217 | 217 | */ |
218 | - public function updateShifts($year,$shift){ |
|
218 | + public function updateShifts($year, $shift) { |
|
219 | 219 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
220 | - $this->shifts->where('id',$shift['id'])->update(['cloned' => $year]); |
|
220 | + $this->shifts->where('id', $shift['id'])->update(['cloned' => $year]); |
|
221 | 221 | $shift['academic_period_id'] = $academicPeriod->id; |
222 | 222 | $exist = $this->shifts->shiftExists($shift); |
223 | - return $this->shifts->create((array)$shift)->id; |
|
223 | + return $this->shifts->create((array) $shift)->id; |
|
224 | 224 | } |
225 | 225 | } |