@@ -69,31 +69,31 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * |
| 71 | 71 | */ |
| 72 | - public static function isDuplicated($inputs){ |
|
| 72 | + public static function isDuplicated($inputs) { |
|
| 73 | 73 | |
| 74 | - $exists = self::where('student_id','=',$inputs['student_id']) |
|
| 75 | - ->where('institution_subject_id','=',$inputs['institution_subject_id']) |
|
| 76 | - ->where('education_subject_id','=',$inputs['education_subject_id'])->count(); |
|
| 74 | + $exists = self::where('student_id', '=', $inputs['student_id']) |
|
| 75 | + ->where('institution_subject_id', '=', $inputs['institution_subject_id']) |
|
| 76 | + ->where('education_subject_id', '=', $inputs['education_subject_id'])->count(); |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | return $exists ? true :false; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - public function student(){ |
|
| 84 | - return $this->belongsTo('App\Models\Security_user','student_id'); |
|
| 83 | + public function student() { |
|
| 84 | + return $this->belongsTo('App\Models\Security_user', 'student_id'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public static function getStudentsCount(){ |
|
| 87 | + public static function getStudentsCount() { |
|
| 88 | 88 | $total_male_students = self::with(['student' => function($query) { |
| 89 | 89 | $query->where('student.gender_id', '=', 1); |
| 90 | - }])->whereHas('student', function ($query) { |
|
| 90 | + }])->whereHas('student', function($query) { |
|
| 91 | 91 | $query->where('gender_id', '=', 1); |
| 92 | 92 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 93 | 93 | |
| 94 | 94 | $total_female_students = self::with(['student' => function($query) { |
| 95 | 95 | $query->where('student.gender_id', '=', 2); |
| 96 | - }])->whereHas('student', function ($query) { |
|
| 96 | + }])->whereHas('student', function($query) { |
|
| 97 | 97 | $query->where('gender_id', '=', 2); |
| 98 | 98 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 99 | 99 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | 'preferred' => 1 |
| 59 | 59 | ]; |
| 60 | 60 | self::updateOrCreate($data); |
| 61 | - }else { |
|
| 61 | + } else { |
|
| 62 | 62 | $exists = $exists->toArray(); |
| 63 | 63 | $exists['preferred'] = 1; |
| 64 | 64 | $exists['value'] = $data['contact']; |
@@ -121,24 +121,24 @@ |
||
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - public function getAuthPassword(){ |
|
| 124 | + public function getAuthPassword() { |
|
| 125 | 125 | return $this->password; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function uploads(){ |
|
| 128 | + public function uploads() { |
|
| 129 | 129 | return $this->hasMany('App\Models\Upload'); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function class(){ |
| 133 | - return $this->belongsTo('App\Models\Institution_class_student','id','student_id'); |
|
| 133 | + return $this->belongsTo('App\Models\Institution_class_student', 'id', 'student_id'); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - public function special_needs(){ |
|
| 137 | - return $this->hasMany('App\Models\User_special_need','id','security_user_id'); |
|
| 136 | + public function special_needs() { |
|
| 137 | + return $this->hasMany('App\Models\User_special_need', 'id', 'security_user_id'); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - public function genUUID(){ |
|
| 140 | + public function genUUID() { |
|
| 141 | 141 | $uuid = Uuid::generate(4); |
| 142 | - return str_split($uuid,'8')[0]; |
|
| 142 | + return str_split($uuid, '8')[0]; |
|
| 143 | 143 | } |
| 144 | 144 | } |
@@ -41,20 +41,20 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | protected $dates = ['modified', 'created']; |
| 43 | 43 | |
| 44 | - public function shiftExists($shift){ |
|
| 44 | + public function shiftExists($shift) { |
|
| 45 | 45 | return self::query() |
| 46 | - ->where('institution_id',$shift['institution_id']) |
|
| 47 | - ->where('location_institution_id',$shift['location_institution_id']) |
|
| 48 | - ->where('shift_option_id',$shift['shift_option_id']) |
|
| 49 | - ->where('academic_period_id',$shift['academic_period_id'])->exists(); |
|
| 46 | + ->where('institution_id', $shift['institution_id']) |
|
| 47 | + ->where('location_institution_id', $shift['location_institution_id']) |
|
| 48 | + ->where('shift_option_id', $shift['shift_option_id']) |
|
| 49 | + ->where('academic_period_id', $shift['academic_period_id'])->exists(); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getShiftsToClone(int $year){ |
|
| 52 | + public function getShiftsToClone(int $year) { |
|
| 53 | 53 | return self::query() |
| 54 | 54 | ->select('institution_shifts.*') |
| 55 | - ->join('academic_periods','academic_periods.id','=','institution_shifts.academic_period_id') |
|
| 55 | + ->join('academic_periods', 'academic_periods.id', '=', 'institution_shifts.academic_period_id') |
|
| 56 | 56 | // ->where('academic_periods.code',$year) |
| 57 | - ->where('institution_shifts.cloned',$year) |
|
| 57 | + ->where('institution_shifts.cloned', $year) |
|
| 58 | 58 | ->get()->toArray(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -69,32 +69,32 @@ |
||
| 69 | 69 | protected $dates = ['email_verified_at']; |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - public function permissions(){ |
|
| 73 | - return $this->hasMany('App\Models\Security_group_user','security_user_id','id') |
|
| 74 | - ->where('security_group_users.security_role_id','=',5) |
|
| 75 | - ->with(['security_group_institution','institution_staff','security_group' , 'staff_class','institution_group' , 'roles']); |
|
| 72 | + public function permissions() { |
|
| 73 | + return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id') |
|
| 74 | + ->where('security_group_users.security_role_id', '=', 5) |
|
| 75 | + ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function principal(){ |
|
| 79 | - return $this->hasMany('App\Models\Security_group_user','security_user_id','id') |
|
| 80 | - ->where('security_group_users.security_role_id','=',4) |
|
| 81 | - ->with(['security_group_institution','institution_staff','security_group' , 'staff_class','institution_group' , 'roles']); |
|
| 78 | + public function principal() { |
|
| 79 | + return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id') |
|
| 80 | + ->where('security_group_users.security_role_id', '=', 4) |
|
| 81 | + ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function zonal_cordinator(){ |
|
| 85 | - return $this->hasMany('App\Models\Security_group_user','security_user_id','id') |
|
| 86 | - ->where('security_group_users.security_role_id','=',3) |
|
| 87 | - ->with(['security_group_institution','institution_staff','security_group' , 'staff_class','institution_group' , 'roles']); |
|
| 84 | + public function zonal_cordinator() { |
|
| 85 | + return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id') |
|
| 86 | + ->where('security_group_users.security_role_id', '=', 3) |
|
| 87 | + ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | - public function institution_class_teacher(){ |
|
| 92 | - return $this->hasMany('App\Models\Institution_staff','staff_id','id') |
|
| 91 | + public function institution_class_teacher() { |
|
| 92 | + return $this->hasMany('App\Models\Institution_staff', 'staff_id', 'id') |
|
| 93 | 93 | ->with(['staff_class']); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function teacher_classes(){ |
|
| 97 | - return $this->hasMany('App\Models\Institution_class','staff_id','id'); |
|
| 96 | + public function teacher_classes() { |
|
| 97 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'id'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function findForPassport($username) { |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | protected $dates = ['special_need_date', 'modified', 'created']; |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - public static function isDuplicated($inputs){ |
|
| 45 | + public static function isDuplicated($inputs) { |
|
| 46 | 46 | |
| 47 | - $exists = self::where('security_user_id','=',$inputs['security_user_id']) |
|
| 48 | - ->where('special_need_type_id','=',$inputs['special_need_type_id']) |
|
| 49 | - ->where('special_need_difficulty_id','=',$inputs['special_need_difficulty_id'])->count(); |
|
| 47 | + $exists = self::where('security_user_id', '=', $inputs['security_user_id']) |
|
| 48 | + ->where('special_need_type_id', '=', $inputs['special_need_type_id']) |
|
| 49 | + ->where('special_need_difficulty_id', '=', $inputs['special_need_difficulty_id'])->count(); |
|
| 50 | 50 | |
| 51 | 51 | // dd($exists); |
| 52 | 52 | return $exists == 0 ? true :false; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // $results = $gradeOptions; |
| 67 | 67 | // } |
| 68 | 68 | return $gradeOptions; |
| 69 | - }else { |
|
| 69 | + } else { |
|
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
| 84 | 84 | } |
| 85 | - }else { |
|
| 85 | + } else { |
|
| 86 | 86 | $results = []; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if (!empty($nextProgrammeList)) { |
| 103 | 103 | $results = self::whereIn('education_programme_id', $nextProgrammeList) |
| 104 | 104 | ->get()->toArray(); |
| 105 | - }else { |
|
| 105 | + } else { |
|
| 106 | 106 | $results = []; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -106,9 +106,9 @@ |
||
| 106 | 106 | * @param $gradeId |
| 107 | 107 | * @return mixed |
| 108 | 108 | */ |
| 109 | - public function getInstitutionGrade($institutionId, $gradeId){ |
|
| 110 | - return self::where('education_grade_id',$gradeId) |
|
| 111 | - ->where('institution_id',$institutionId)->get()->first(); |
|
| 109 | + public function getInstitutionGrade($institutionId, $gradeId) { |
|
| 110 | + return self::where('education_grade_id', $gradeId) |
|
| 111 | + ->where('institution_id', $institutionId)->get()->first(); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | ->where('institution_grades.education_grade_id', $educationGradeId) |
| 84 | 84 | ->where('institution_grades.institution_id', $institutionId) |
| 85 | 85 | ->get(); |
| 86 | - }else { |
|
| 86 | + } else { |
|
| 87 | 87 | return null; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | protected $dates = ['date_opened', 'date_closed', 'modified', 'created']; |
| 43 | 43 | |
| 44 | - public function isActive($id){ |
|
| 44 | + public function isActive($id) { |
|
| 45 | 45 | return self::query()->find($id)->get()->first()->institution_status_id == 1; |
| 46 | 46 | } |
| 47 | 47 | |