@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | public function getParallelClasses($id, $institutionId, $educationGradeId, $academicPeriodId) |
71 | 71 | { |
72 | 72 | $data = self::find($id)->select('institution_grades.id as insGrade', 'institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') |
73 | - ->join('institution_classes', function ($join) use ($educationGradeId, $academicPeriodId) { |
|
73 | + ->join('institution_classes', function($join) use ($educationGradeId, $academicPeriodId) { |
|
74 | 74 | $join->on('institution_classes.institution_id', '=', 'institution_grades.institution_id') |
75 | 75 | ->where('institution_classes.academic_period_id', $academicPeriodId) |
76 | - ->join('institution_class_grades', function ($join) use ($educationGradeId) { |
|
76 | + ->join('institution_class_grades', function($join) use ($educationGradeId) { |
|
77 | 77 | $join->on('institution_class_grades.institution_class_id', '=', 'institution_classes.id') |
78 | 78 | ->where('institution_class_grades.education_grade_id', $educationGradeId); |
79 | 79 | }) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
124 | 124 | // ->where('promoted', '=', $year) |
125 | 125 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
126 | - ->join('institutions', function ($join) use ($year, $institution) { |
|
126 | + ->join('institutions', function($join) use ($year, $institution) { |
|
127 | 127 | $join->on('institutions.id', '=', 'institution_grades.institution_id') |
128 | 128 | ->where('institutions.code', '=', $institution); |
129 | 129 | }) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | break; |
135 | 135 | case '6-11': |
136 | 136 | $query->whereIn('education_programmes.education_cycle_id', [2, 3]); |
137 | - $query->whereNotIn('education_grades.id',[29,34]); |
|
137 | + $query->whereNotIn('education_grades.id', [29, 34]); |
|
138 | 138 | break; |
139 | 139 | case 'AL': |
140 | 140 | $query->where('education_programmes.education_cycle_id', 4); |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | * @param $year |
153 | 153 | * @return mixed |
154 | 154 | */ |
155 | - public function getInstitutionGradeList($year, $limit,$mode) |
|
155 | + public function getInstitutionGradeList($year, $limit, $mode) |
|
156 | 156 | { |
157 | 157 | $query = $this->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
158 | 158 | // ->where('promoted', '=', $year) |
159 | 159 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
160 | - ->join('institutions', function ($join) use ($year) { |
|
160 | + ->join('institutions', function($join) use ($year) { |
|
161 | 161 | $join->on('institutions.id', '=', 'institution_grades.institution_id'); |
162 | 162 | }) |
163 | 163 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id'); |
164 | 164 | switch ($mode) { |
165 | 165 | case '1-5': |
166 | - $query->whereIn('education_programmes.education_cycle_id', [1,2]); |
|
166 | + $query->whereIn('education_programmes.education_cycle_id', [1, 2]); |
|
167 | 167 | break; |
168 | 168 | case '6-11': |
169 | - $query->whereIn('education_programmes.education_cycle_id', [2,3,4]); |
|
169 | + $query->whereIn('education_programmes.education_cycle_id', [2, 3, 4]); |
|
170 | 170 | break; |
171 | 171 | case 'AL': |
172 | 172 | $query->where('education_programmes.education_cycle_id', 4); |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | return $data; |
182 | 182 | } |
183 | 183 | |
184 | - public function getGradeSubjects($institutionId){ |
|
184 | + public function getGradeSubjects($institutionId) { |
|
185 | 185 | return self::query() |
186 | - ->select('institution_grades.institution_id','education_grades_subjects.education_grade_id','education_grades_subjects.education_subject_id','education_subjects.name') |
|
187 | - ->where('institution_grades.institution_id',$institutionId) |
|
186 | + ->select('institution_grades.institution_id', 'education_grades_subjects.education_grade_id', 'education_grades_subjects.education_subject_id', 'education_subjects.name') |
|
187 | + ->where('institution_grades.institution_id', $institutionId) |
|
188 | 188 | ->join('education_grades', 'institution_grades.education_grade_id', 'education_grades.id') |
189 | - ->join('education_grades_subjects','education_grades.id','education_grades_subjects.education_grade_id') |
|
190 | - ->join('education_subjects','education_grades_subjects.education_subject_id','education_subjects.id') |
|
189 | + ->join('education_grades_subjects', 'education_grades.id', 'education_grades_subjects.education_grade_id') |
|
190 | + ->join('education_subjects', 'education_grades_subjects.education_subject_id', 'education_subjects.id') |
|
191 | 191 | ->groupBy('education_grades_subjects.id') |
192 | 192 | ->get() |
193 | 193 | ->toArray(); |
@@ -25,11 +25,11 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function boot() |
|
29 | - { |
|
30 | - // |
|
31 | - if(!(\App::environment('local'))) { |
|
32 | - URL::forceScheme('https'); |
|
33 | - } |
|
34 | - } |
|
28 | + public function boot() |
|
29 | + { |
|
30 | + // |
|
31 | + if(!(\App::environment('local'))) { |
|
32 | + URL::forceScheme('https'); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function boot() |
29 | 29 | { |
30 | 30 | // |
31 | - if(!(\App::environment('local'))) { |
|
31 | + if (!(\App::environment('local'))) { |
|
32 | 32 | URL::forceScheme('https'); |
33 | 33 | } |
34 | 34 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group_institution extends Model { |
|
7 | +class Security_group_institution extends Model { |
|
8 | 8 | |
9 | 9 | |
10 | 10 | /** |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - public function institution(){ |
|
48 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
47 | + public function institution() { |
|
48 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function institution_classes(){ |
|
52 | - return $this->hasMany('App\Models\Institution_class','institution_id','institution_id') |
|
51 | + public function institution_classes() { |
|
52 | + return $this->hasMany('App\Models\Institution_class', 'institution_id', 'institution_id') |
|
53 | 53 | ->select('institution_classes.*') |
54 | - ->join('academic_periods', function($query){ |
|
55 | - $query->on('institution_classes.academic_period_id','academic_periods.id'); |
|
56 | - $query->whereIn('academic_periods.code',['2020','2019/2020']); |
|
54 | + ->join('academic_periods', function($query) { |
|
55 | + $query->on('institution_classes.academic_period_id', 'academic_periods.id'); |
|
56 | + $query->whereIn('academic_periods.code', ['2020', '2019/2020']); |
|
57 | 57 | }); |
58 | 58 | } |
59 | 59 | |
60 | - public function security_group(){ |
|
61 | - return $this->belongsTo('App\Models\Security_group','security_group_id'); |
|
60 | + public function security_group() { |
|
61 | + return $this->belongsTo('App\Models\Security_group', 'security_group_id'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group_user extends Model { |
|
7 | +class Security_group_user extends Model { |
|
8 | 8 | |
9 | 9 | public const CREATED_AT = 'created'; |
10 | 10 | public const UPDATED_AT = 'modified'; |
@@ -45,39 +45,39 @@ discard block |
||
45 | 45 | protected $dates = ['modified', 'created', 'created']; |
46 | 46 | |
47 | 47 | |
48 | - public function security_user(){ |
|
49 | - return $this->belongsToMany('App\Models\User','security_users'); |
|
48 | + public function security_user() { |
|
49 | + return $this->belongsToMany('App\Models\User', 'security_users'); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function security_group(){ |
|
53 | - return $this->hasMany('App\Models\Security_group' , 'id','security_group_id'); |
|
52 | + public function security_group() { |
|
53 | + return $this->hasMany('App\Models\Security_group', 'id', 'security_group_id'); |
|
54 | 54 | } |
55 | 55 | |
56 | - public function security_group_institution(){ |
|
57 | - return $this->belongsTo('App\Models\Security_group_institution','security_group_id','security_group_id'); |
|
56 | + public function security_group_institution() { |
|
57 | + return $this->belongsTo('App\Models\Security_group_institution', 'security_group_id', 'security_group_id'); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function staff_class(){ |
|
61 | - return $this->hasMany('App\Models\Institution_class','staff_id','security_user_id') |
|
60 | + public function staff_class() { |
|
61 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'security_user_id') |
|
62 | 62 | ->select('institution_classes.*') |
63 | - ->join('academic_periods',function($query){ |
|
64 | - $query->on('institution_classes.academic_period_id','academic_periods.id'); |
|
65 | - $query->whereIn('academic_periods.code',['2020','2019/2020']); |
|
63 | + ->join('academic_periods', function($query) { |
|
64 | + $query->on('institution_classes.academic_period_id', 'academic_periods.id'); |
|
65 | + $query->whereIn('academic_periods.code', ['2020', '2019/2020']); |
|
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | - public function institution_staff(){ |
|
70 | - return $this->belongsTo('App\Models\Institution_staff','security_user_id','staff_id'); |
|
69 | + public function institution_staff() { |
|
70 | + return $this->belongsTo('App\Models\Institution_staff', 'security_user_id', 'staff_id'); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function institution_group(){ |
|
74 | - return $this->hasMany('App\Models\Security_group_institution','security_group_id','security_group_id') |
|
75 | - ->with(['institution','institution_classes']); |
|
73 | + public function institution_group() { |
|
74 | + return $this->hasMany('App\Models\Security_group_institution', 'security_group_id', 'security_group_id') |
|
75 | + ->with(['institution', 'institution_classes']); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | - public function roles(){ |
|
80 | - return $this->belongsTo('App\Models\Security_role','security_role_id','id'); |
|
79 | + public function roles() { |
|
80 | + return $this->belongsTo('App\Models\Security_role', 'security_role_id', 'id'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_staff extends Model { |
|
7 | +class Institution_staff extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | protected $dates = ['start_date', 'end_date', 'modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function staff_class(){ |
|
46 | - return $this->hasMany('App\Models\Institution_class','staff_id','staff_id') |
|
47 | - ->innerJoin('academic_periods','institution_classes.academic_period_id','academic_periods.id') |
|
48 | - ->where('academic_periods.current',1); |
|
45 | + public function staff_class() { |
|
46 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'staff_id') |
|
47 | + ->innerJoin('academic_periods', 'institution_classes.academic_period_id', 'academic_periods.id') |
|
48 | + ->where('academic_periods.current', 1); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function institution(){ |
|
52 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
51 | + public function institution() { |
|
52 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | $highestColumn = $this->worksheet->getHighestDataColumn(3); |
90 | 90 | $higestRow = 0; |
91 | 91 | for ($row = $this->startRow(); $row <= $this->highestRow; $row++) { |
92 | - $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); |
|
92 | + $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
|
93 | 93 | if (isEmptyRow(reset($rowData))) { |
94 | 94 | continue; |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | $higestRow += 1; |
97 | 97 | } |
98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->failures = []; |
107 | 107 | if (($column !== "") && (!in_array($column, $columns))) { |
108 | 108 | $this->isValidSheet = false; |
109 | - $this->error[] = 'Unsupported column found ,remove:' . $column; |
|
109 | + $this->error[] = 'Unsupported column found ,remove:'.$column; |
|
110 | 110 | $this->failure = new Failure(3, 'remark', $this->error, [null]); |
111 | 111 | $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]); |
112 | 112 | } |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | { |
120 | 120 | $columns = Config::get('excel.columns'); |
121 | 121 | $optional_columns = Config::get('excel.optional_columns'); |
122 | - $columns = array_diff ($columns,$optional_columns); |
|
122 | + $columns = array_diff($columns, $optional_columns); |
|
123 | 123 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
124 | 124 | $this->failures = []; |
125 | 125 | foreach ($columns as $column) { |
126 | 126 | if (($column !== "") && (!in_array($column, $existingColumns))) { |
127 | 127 | $this->isValidSheet = false; |
128 | - $this->error[] = 'Missing Column :' . $column . ' Not found'; |
|
128 | + $this->error[] = 'Missing Column :'.$column.' Not found'; |
|
129 | 129 | $this->failure = new Failure(3, 'remark', $this->error, [null]); |
130 | 130 | $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]); |
131 | 131 | } |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | $highestColumn = $this->worksheet->getHighestDataColumn(3); |
143 | 143 | $higestRow = 1; |
144 | 144 | for ($row = $this->startRow(); $row <= $this->highestRow; $row++) { |
145 | - $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); |
|
145 | + $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
|
146 | 146 | if (isEmptyRow(reset($rowData))) { |
147 | 147 | continue; |
148 | - } else { |
|
148 | + }else { |
|
149 | 149 | $higestRow += 1; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | if ($higestRow == 0) { |
153 | 153 | exit; |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | return $higestRow; |
156 | 156 | } |
157 | 157 | } |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | case 'string': |
177 | 177 | $row[$column] = preg_replace('/[^A-Za-z0-9\-]/', '-', $row[$column]); |
178 | 178 | $row[$column] = date($format, strtotime($row[$column])); //date($row[$column]); |
179 | - $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]); |
|
179 | + $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]); |
|
180 | 180 | break; |
181 | 181 | case 'double'; |
182 | - $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]); |
|
182 | + $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]); |
|
183 | 183 | break; |
184 | 184 | } |
185 | 185 | } |
186 | 186 | return $row; |
187 | - } catch (Exception $e) { |
|
187 | + }catch (Exception $e) { |
|
188 | 188 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
189 | - $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $row[$column] . ' Not a valid date formate'], [null]); |
|
189 | + $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$row[$column].' Not a valid date formate'], [null]); |
|
190 | 190 | $failures = [0 => $failure]; |
191 | 191 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
192 | 192 | } |
@@ -207,18 +207,18 @@ discard block |
||
207 | 207 | $row = $this->formateDate($row, 'mothers_date_of_birth_yyyy_mm_dd'); |
208 | 208 | $row = $this->formateDate($row, 'guardians_date_of_birth_yyyy_mm_dd'); |
209 | 209 | |
210 | - $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT); |
|
210 | + $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT); |
|
211 | 211 | |
212 | 212 | if (array_key_exists('identity_type', $row)) { |
213 | 213 | if ($row['identity_type'] == 'BC' && (!empty($row['birth_divisional_secretariat'])) && ($row['identity_number'] !== null) && $row['date_of_birth_yyyy_mm_dd'] !== null) { |
214 | - $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT); |
|
214 | + $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT); |
|
215 | 215 | // dd(($row['date_of_birth_yyyy_mm_dd'])); |
216 | - $BirthDivision = Area_administrative::where('name', 'like', '%' . $row['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5)->first(); |
|
216 | + $BirthDivision = Area_administrative::where('name', 'like', '%'.$row['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5)->first(); |
|
217 | 217 | if ($BirthDivision !== null) { |
218 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%') |
|
218 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%') |
|
219 | 219 | ->where('parent_id', '=', $BirthDivision->id)->first(); |
220 | 220 | if ($BirthArea !== null) { |
221 | - $row['identity_number'] = $BirthArea->id . '' . $row['identity_number'] . '' . substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2) . '' . $row['date_of_birth_yyyy_mm_dd']->format("m"); |
|
221 | + $row['identity_number'] = $BirthArea->id.''.$row['identity_number'].''.substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2).''.$row['date_of_birth_yyyy_mm_dd']->format("m"); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | { |
232 | 232 | if (array_key_exists($key, $row)) { |
233 | 233 | return true; |
234 | - } else { |
|
234 | + }else { |
|
235 | 235 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
236 | - $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $key, ' Is missing form the template'], [null]); |
|
236 | + $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$key, ' Is missing form the template'], [null]); |
|
237 | 237 | $failures = [0 => $failure]; |
238 | 238 | new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
239 | 239 | }; |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | $exceededStudents = ($totalStudents + $this->limit()) > $institutionClass->no_of_students ? true : false; |
269 | 269 | if ($exceededStudents == true) { |
270 | 270 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
271 | - $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is' . $institutionClass->no_of_students], [null]); |
|
271 | + $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is'.$institutionClass->no_of_students], [null]); |
|
272 | 272 | $failures = [0 => $failure]; |
273 | 273 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
274 | 274 | Log::info('email-sent', [$this->file]); |
275 | - } else { |
|
275 | + }else { |
|
276 | 276 | return true; |
277 | 277 | } |
278 | 278 | } |
@@ -331,20 +331,20 @@ discard block |
||
331 | 331 | $this->updateSubjectCount($subject); |
332 | 332 | } |
333 | 333 | |
334 | - public function createOrUpdateGuardian($row,$student,$param){ |
|
334 | + public function createOrUpdateGuardian($row, $student, $param) { |
|
335 | 335 | if (!empty($row[$param.'s_full_name']) && ($row[$param.'s_date_of_birth_yyyy_mm_dd'] !== null)) { |
336 | 336 | $guardian = Security_user::createOrUpdateGuardianProfile($row, $param, $this->file); |
337 | 337 | if (!is_null($guardian)) { |
338 | 338 | Security_user::where('id', '=', $guardian->id) |
339 | 339 | ->update(['is_guardian' => 1]); |
340 | - $guardian['guardian_relation_id'] = $this->setRelation($param,$guardian); |
|
340 | + $guardian['guardian_relation_id'] = $this->setRelation($param, $guardian); |
|
341 | 341 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
342 | 342 | } |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - protected function setRelation($param,$guardian){ |
|
347 | - switch($param){ |
|
346 | + protected function setRelation($param, $guardian) { |
|
347 | + switch ($param) { |
|
348 | 348 | case 'father': |
349 | 349 | return 1; |
350 | 350 | case 'mother': |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | - protected function setGender($row){ |
|
357 | + protected function setGender($row) { |
|
358 | 358 | switch ($row['gender_mf']) { |
359 | 359 | case 'M': |
360 | 360 | $row['gender_mf'] = 1; |
@@ -368,17 +368,17 @@ discard block |
||
368 | 368 | return $row; |
369 | 369 | } |
370 | 370 | |
371 | - protected function insertOrUpdateSubjects($row,$student,$institution){ |
|
371 | + protected function insertOrUpdateSubjects($row, $student, $institution) { |
|
372 | 372 | $mandatorySubject = Institution_class_subject::getMandatorySubjects($this->file['institution_class_id']); |
373 | 373 | $subjects = getMatchingKeys($row); |
374 | - $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
374 | + $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
375 | 375 | $allSubjects = array_merge_recursive($optionalSubjects, $mandatorySubject); |
376 | 376 | if (!empty($allSubjects)) { |
377 | 377 | $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id'); |
378 | 378 | $this->student = $student; |
379 | - $allSubjects = array_map(array($this,'setStudentSubjects'),$allSubjects); |
|
379 | + $allSubjects = array_map(array($this, 'setStudentSubjects'), $allSubjects); |
|
380 | 380 | $allSubjects = unique_multidim_array($allSubjects, 'education_subject_id'); |
381 | - array_walk($allSubjects,array($this,'insertSubject')); |
|
381 | + array_walk($allSubjects, array($this, 'insertSubject')); |
|
382 | 382 | array_walk($allSubjects, array($this, 'updateSubjectCount')); |
383 | 383 | } |
384 | 384 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $studentData['id'] = $id; |
205 | 205 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
206 | 206 | return $studentData; |
207 | - } catch (\Exception $th) { |
|
207 | + }catch (\Exception $th) { |
|
208 | 208 | Log::error($th->getMessage()); |
209 | 209 | // in case of duplication of the Unique ID this will recursive. |
210 | 210 | $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->uniqueUserId = new Unique_user_id(); |
226 | 226 | $this->uniqueUId = new UniqueUid(); |
227 | 227 | // regenerate unique id if it's not available |
228 | - $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
228 | + $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
229 | 229 | |
230 | 230 | $studentData = [ |
231 | 231 | 'username' => str_replace('-', '', $uniqueId), |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $studentData['id'] = $sis_student['student_id']; |
244 | 244 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
245 | 245 | return $studentData; |
246 | - } catch (\Exception $th) { |
|
246 | + }catch (\Exception $th) { |
|
247 | 247 | Log::error($th); |
248 | 248 | // in case of duplication of the Unique ID this will recursive. |
249 | 249 | $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | { |
256 | 256 | try { |
257 | 257 | $uniqueUid = new UniqueUid(); |
258 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
259 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
260 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
258 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
259 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
260 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
261 | 261 | |
262 | 262 | $date = $row['date_of_birth_yyyy_mm_dd']; |
263 | 263 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ]); |
290 | 290 | case 'update': |
291 | 291 | if (!is_null($row['student_id'])) { |
292 | - $studentInfo = Security_user::where('openemis_no',trim($row['student_id']))->first(); |
|
292 | + $studentInfo = Security_user::where('openemis_no', trim($row['student_id']))->first(); |
|
293 | 293 | self::query()->where('openemis_no', $row['student_id']) |
294 | 294 | ->update([ |
295 | 295 | 'first_name' => $row['full_name'] ? $row['full_name'] : $studentInfo['first_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | break; |
312 | 312 | } |
313 | - } catch (\Exception $e) { |
|
313 | + }catch (\Exception $e) { |
|
314 | 314 | dd($e); |
315 | 315 | } |
316 | 316 | } |
@@ -319,48 +319,48 @@ discard block |
||
319 | 319 | { |
320 | 320 | try { |
321 | 321 | $uniqueUid = new UniqueUid(); |
322 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row[$prefix . 's_address_area'] . '%')->first(); |
|
323 | - $nationalityId = Nationality::where('name', 'like', '%' . $row[$prefix . 's_nationality'] . '%')->first(); |
|
324 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row[$prefix . 's_identity_type'] . '%')->first(); |
|
322 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row[$prefix.'s_address_area'].'%')->first(); |
|
323 | + $nationalityId = Nationality::where('name', 'like', '%'.$row[$prefix.'s_nationality'].'%')->first(); |
|
324 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row[$prefix.'s_identity_type'].'%')->first(); |
|
325 | 325 | $openemisNo = $uniqueUid::getUniqueAlphanumeric(); |
326 | 326 | |
327 | 327 | $identityType = ($identityType !== null) ? $identityType->id : null; |
328 | 328 | $nationalityId = $nationalityId !== null ? $nationalityId->id : null; |
329 | 329 | |
330 | 330 | $guardian = null; |
331 | - if (!empty($row[$prefix . 's_identity_number'])) { |
|
331 | + if (!empty($row[$prefix.'s_identity_number'])) { |
|
332 | 332 | $guardian = Security_user::where('identity_type_id', '=', $nationalityId) |
333 | - ->where('identity_number', '=', $row[$prefix . 's_identity_number'])->first(); |
|
333 | + ->where('identity_number', '=', $row[$prefix.'s_identity_number'])->first(); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if (is_null($guardian)) { |
337 | 337 | $guardian = self::create([ |
338 | 338 | 'username' => str_replace('-', '', $openemisNo), |
339 | 339 | 'openemis_no' => $openemisNo, |
340 | - 'first_name' => $row[$prefix . 's_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
|
341 | - 'last_name' => genNameWithInitials($row[$prefix . 's_full_name']), |
|
340 | + 'first_name' => $row[$prefix.'s_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
|
341 | + 'last_name' => genNameWithInitials($row[$prefix.'s_full_name']), |
|
342 | 342 | 'gender_id' => 1, |
343 | - 'date_of_birth' => $row[$prefix . 's_date_of_birth_yyyy_mm_dd'], |
|
344 | - 'address' => $row[$prefix . 's_address'], |
|
343 | + 'date_of_birth' => $row[$prefix.'s_date_of_birth_yyyy_mm_dd'], |
|
344 | + 'address' => $row[$prefix.'s_address'], |
|
345 | 345 | 'address_area_id' => $AddressArea ? $AddressArea->id : null, |
346 | 346 | 'nationality_id' => $nationalityId, |
347 | 347 | 'identity_type_id' => $identityType, |
348 | - 'identity_number' => $row[$prefix . 's_identity_number'], |
|
348 | + 'identity_number' => $row[$prefix.'s_identity_number'], |
|
349 | 349 | 'is_guardian' => 1, |
350 | 350 | 'created_user_id' => $file['security_user_id'] |
351 | 351 | ]); |
352 | 352 | |
353 | 353 | |
354 | 354 | $guardian['guardian_relation_id'] = 1; |
355 | - if (array_key_exists($prefix . 's_phone', $row)) { |
|
356 | - $father['contact'] = $row[$prefix . 's_phone']; |
|
355 | + if (array_key_exists($prefix.'s_phone', $row)) { |
|
356 | + $father['contact'] = $row[$prefix.'s_phone']; |
|
357 | 357 | User_contact::createOrUpdate($father, $file['security_user_id']); |
358 | 358 | } |
359 | - } else { |
|
360 | - Security_user::where('id', $guardian->id)->update(['address_area_id' => $AddressArea ? $AddressArea->id : null,]); |
|
359 | + }else { |
|
360 | + Security_user::where('id', $guardian->id)->update(['address_area_id' => $AddressArea ? $AddressArea->id : null, ]); |
|
361 | 361 | } |
362 | 362 | return $guardian; |
363 | - } catch (\Exception $e) { |
|
363 | + }catch (\Exception $e) { |
|
364 | 364 | Log::error($e->getMessage(), [$e]); |
365 | 365 | } |
366 | 366 | } |
@@ -72,18 +72,18 @@ |
||
72 | 72 | 'institution_id' => $admissionInfo['instituion']->id, |
73 | 73 | 'academic_period_id' => $admissionInfo['academic_period']->id, |
74 | 74 | 'education_grade_id' => $admissionInfo['education_grade']->id, |
75 | - 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class'])==1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
75 | + 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class']) == 1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
76 | 76 | 'comment' => 'Imported From Examination Data', |
77 | 77 | 'updated_from' => 'doe', |
78 | 78 | 'created_user_id' => 1 |
79 | 79 | ]; |
80 | 80 | self::create($data); |
81 | - } catch (\Throwable $th) { |
|
81 | + }catch (\Throwable $th) { |
|
82 | 82 | Log::error($th); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - public static function createAdmission($studentId,$row,$params,$file){ |
|
86 | + public static function createAdmission($studentId, $row, $params, $file) { |
|
87 | 87 | self::create([ |
88 | 88 | 'start_date' => $row['start_date_yyyy_mm_dd'], |
89 | 89 | 'start_year' => $row['start_date_yyyy_mm_dd']->format('Y'), |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group extends Model { |
|
7 | +class Security_group extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected $dates = ['modified', 'created', 'created', 'created', 'modified', 'created']; |
43 | 43 | |
44 | - public function security_users(){ |
|
45 | - return $this->belongsTo('App\Models\Security_group_user','security_group_id'); |
|
44 | + public function security_users() { |
|
45 | + return $this->belongsTo('App\Models\Security_group_user', 'security_group_id'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | - public function security_group_institution(){ |
|
50 | - return $this->hasMany('App\Models\Security_group_institution','security_group_id'); |
|
49 | + public function security_group_institution() { |
|
50 | + return $this->hasMany('App\Models\Security_group_institution', 'security_group_id'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
54 | 54 | \ No newline at end of file |