@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | $this->isValidSheet = false; |
102 | 102 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
103 | - $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
|
104 | - $failures = [0 => $failure]; |
|
105 | - throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
|
103 | + $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
|
104 | + $failures = [0 => $failure]; |
|
105 | + throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | protected function checkKeys($key,$count,$row){ |
197 | - if(array_key_exists($key,$row)){ |
|
198 | - return true; |
|
199 | - }else{ |
|
197 | + if(array_key_exists($key,$row)){ |
|
198 | + return true; |
|
199 | + }else{ |
|
200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
201 | 201 | $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]); |
202 | 202 | $failures = [0 => $failure]; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function map($row): array { |
218 | 218 | try { |
219 | - $row = $this->mapFields($row); |
|
219 | + $row = $this->mapFields($row); |
|
220 | 220 | } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
221 | 221 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
222 | 222 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
@@ -18,10 +18,10 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | - * @param array $row |
|
22 | - * |
|
23 | - * @return \Illuminate\Database\Eloquent\Model|null |
|
24 | - */ |
|
21 | + * @param array $row |
|
22 | + * |
|
23 | + * @return \Illuminate\Database\Eloquent\Model|null |
|
24 | + */ |
|
25 | 25 | |
26 | 26 | public function sheets(): array |
27 | 27 | { |
@@ -25,11 +25,11 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function boot() |
|
29 | - { |
|
30 | - // |
|
31 | - if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
32 | - URL::forceScheme('https'); |
|
33 | - } |
|
34 | - } |
|
28 | + public function boot() |
|
29 | + { |
|
30 | + // |
|
31 | + if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
32 | + URL::forceScheme('https'); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -135,13 +135,13 @@ |
||
135 | 135 | } |
136 | 136 | protected function validateNic($attribute, $value, $perameters, $validator){ |
137 | 137 | $valid = preg_match('/^([0-9]{9}[VX]|[0-9]{12})$/i', $value); |
138 | - if(!$valid){ |
|
139 | - $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
|
140 | - $this->_set_custom_stuff(); |
|
141 | - return false; |
|
142 | - }else{ |
|
143 | - return true; |
|
144 | - } |
|
138 | + if(!$valid){ |
|
139 | + $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
|
140 | + $this->_set_custom_stuff(); |
|
141 | + return false; |
|
142 | + }else{ |
|
143 | + return true; |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | protected function validateUserUnique($attribute, $value, $perameters, $validator) { |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | public function boot() { |
13 | 13 | $this->app->validator->resolver( function( $translator, $data, $rules, |
14 | - $messages = array(), $customAttributes = array() ) { |
|
14 | + $messages = array(), $customAttributes = array() ) { |
|
15 | 15 | return new ValidatorExtended( $translator, $data, $rules, $messages, |
16 | 16 | $customAttributes ); |
17 | 17 | } ); |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -212,7 +212,7 @@ |
||
212 | 212 | 'created_user_id' => $student['created_user_id'] |
213 | 213 | ]; |
214 | 214 | try{ |
215 | - Institution_student::where('id',(string)$student['id'])->update($studentData); |
|
215 | + Institution_student::where('id',(string)$student['id'])->update($studentData); |
|
216 | 216 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
217 | 217 | $output->writeln('----------------- '. $student['admission_id'] . ' to ' . $studentData['education_grade_id']); |
218 | 218 |
@@ -78,41 +78,41 @@ |
||
78 | 78 | $this->count += 1; |
79 | 79 | $this->student = $student ; |
80 | 80 | try{ |
81 | - Institution_student::create([ |
|
82 | - 'student_status_id' => 1, |
|
83 | - 'student_id' => $student['student_id'], |
|
84 | - 'education_grade_id' => $student['education_grade_id'], |
|
85 | - 'academic_period_id' => $student['academic_period_id'], |
|
86 | - 'start_date' => $student['start_date'], |
|
87 | - 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $student['start_date'])->year , // $student['start_date']->format('Y'), |
|
88 | - 'end_date' => $student['end_date'], |
|
89 | - 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $student['end_date'])->year , //$student['end_date']->format('Y'), |
|
90 | - 'institution_id' => $student['institution_id'], |
|
91 | - 'admission_id' => $student['admission_id'], |
|
92 | - 'created_user_id' => $student['created_user_id'], |
|
93 | - ]); |
|
94 | - |
|
95 | - if(!is_null($student['institution_class_id'])){ |
|
96 | - Institution_class_student::create([ |
|
97 | - 'student_id' => $student['student_id'], |
|
98 | - 'institution_class_id' => $student['institution_class_id'], |
|
99 | - 'education_grade_id' => $student['education_grade_id'], |
|
100 | - 'academic_period_id' => $student['academic_period_id'], |
|
101 | - 'institution_id' =>$student['institution_id'], |
|
102 | - 'student_status_id' => 1, |
|
103 | - 'created_user_id' => $student['created_user_id'], |
|
104 | - ]); |
|
105 | - } |
|
81 | + Institution_student::create([ |
|
82 | + 'student_status_id' => 1, |
|
83 | + 'student_id' => $student['student_id'], |
|
84 | + 'education_grade_id' => $student['education_grade_id'], |
|
85 | + 'academic_period_id' => $student['academic_period_id'], |
|
86 | + 'start_date' => $student['start_date'], |
|
87 | + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $student['start_date'])->year , // $student['start_date']->format('Y'), |
|
88 | + 'end_date' => $student['end_date'], |
|
89 | + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $student['end_date'])->year , //$student['end_date']->format('Y'), |
|
90 | + 'institution_id' => $student['institution_id'], |
|
91 | + 'admission_id' => $student['admission_id'], |
|
92 | + 'created_user_id' => $student['created_user_id'], |
|
93 | + ]); |
|
94 | + |
|
95 | + if(!is_null($student['institution_class_id'])){ |
|
96 | + Institution_class_student::create([ |
|
97 | + 'student_id' => $student['student_id'], |
|
98 | + 'institution_class_id' => $student['institution_class_id'], |
|
99 | + 'education_grade_id' => $student['education_grade_id'], |
|
100 | + 'academic_period_id' => $student['academic_period_id'], |
|
101 | + 'institution_id' =>$student['institution_id'], |
|
102 | + 'student_status_id' => 1, |
|
103 | + 'created_user_id' => $student['created_user_id'], |
|
104 | + ]); |
|
105 | + } |
|
106 | 106 | $output->writeln(' |
107 | 107 | #################################################### |
108 | 108 | Total number of students updated : '.$this->count.' |
109 | 109 | # # |
110 | 110 | ####################################################' ); |
111 | 111 | // $output->writeln(); |
112 | - }catch (\Exception $e){ |
|
112 | + }catch (\Exception $e){ |
|
113 | 113 | // echo $e->getMessage(); |
114 | - $output->writeln( $e->getMessage()); |
|
115 | - } |
|
114 | + $output->writeln( $e->getMessage()); |
|
115 | + } |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $this->end_time = microtime(TRUE); |
77 | 77 | |
78 | 78 | |
79 | - $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
|
80 | - $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete'); |
|
81 | - $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
|
79 | + $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
|
80 | + $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete'); |
|
81 | + $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $this->output->writeln('updating from '. $shiftId); |
114 | 114 | |
115 | 115 | }catch (\Exception $e){ |
116 | - Log::error($e->getMessage(),[$e]); |
|
116 | + Log::error($e->getMessage(),[$e]); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | // DB::commit(); |
120 | 120 | }catch (\Exception $e){ |
121 | 121 | // DB::rollBack(); |
122 | - Log::error($e->getMessage(),[$e]); |
|
122 | + Log::error($e->getMessage(),[$e]); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | * @param $academicPeriod |
131 | 131 | */ |
132 | 132 | public function insertInstitutionSubjects($subjects, $count,$academicPeriod){ |
133 | - try{ |
|
134 | - $subjects['academic_period_id'] = $academicPeriod->id; |
|
135 | - $subjects['created'] = now(); |
|
136 | - unset($subjects['total_male_students']); |
|
137 | - unset($subjects['total_female_students']); |
|
138 | - unset($subjects['id']); |
|
139 | - $classSubject = Institution_subject::create($subjects); |
|
140 | - }catch (\Exception $e){ |
|
133 | + try{ |
|
134 | + $subjects['academic_period_id'] = $academicPeriod->id; |
|
135 | + $subjects['created'] = now(); |
|
136 | + unset($subjects['total_male_students']); |
|
137 | + unset($subjects['total_female_students']); |
|
138 | + unset($subjects['id']); |
|
139 | + $classSubject = Institution_subject::create($subjects); |
|
140 | + }catch (\Exception $e){ |
|
141 | 141 | Log::error($e->getMessage(),[$e]); |
142 | - } |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->insertInstitutionClassSubjects($institutionSubjects,$class); |
182 | 182 | // array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params); |
183 | 183 | }catch (\Exception $e){ |
184 | - Log::error($e->getMessage(),[$e]); |
|
184 | + Log::error($e->getMessage(),[$e]); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | array_walk($subjects,array($this,'insertClassSubjects'),$class); |
192 | 192 | $this->output->writeln('updating subjects '. $class->name); |
193 | 193 | }catch (\Exception $e){ |
194 | - Log::error($e->getMessage(),[$e]); |
|
194 | + Log::error($e->getMessage(),[$e]); |
|
195 | 195 | } |
196 | 196 | }; |
197 | 197 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $this->institution_class_subjects->create($subjectobj); |
210 | 210 | } |
211 | 211 | }catch (\Exception $e){ |
212 | - Log::error($e->getMessage(),[$e]); |
|
212 | + Log::error($e->getMessage(),[$e]); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 |