@@ -107,8 +107,8 @@ |
||
107 | 107 | * @return mixed |
108 | 108 | */ |
109 | 109 | public function getInstitutionGrade($institutionId, $gradeId){ |
110 | - return self::where('education_grade_id',$gradeId) |
|
111 | - ->where('institution_id',$institutionId)->get()->first(); |
|
110 | + return self::where('education_grade_id',$gradeId) |
|
111 | + ->where('institution_id',$institutionId)->get()->first(); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | { |
72 | 72 | if (!is_null($id)) { |
73 | 73 | return self::find($id) |
74 | - ->select('institution_grades.id as insGrade','institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') |
|
75 | - ->join('institution_classes', function ($join) use ($educationGradeId, $academicPeriodId) { |
|
74 | + ->select('institution_grades.id as insGrade', 'institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') |
|
75 | + ->join('institution_classes', function($join) use ($educationGradeId, $academicPeriodId) { |
|
76 | 76 | $join->on('institution_classes.institution_id', '=', 'institution_grades.institution_id') |
77 | 77 | ->where('institution_classes.academic_period_id', $academicPeriodId) |
78 | - ->join('institution_class_grades', function ($join) use ($educationGradeId) { |
|
78 | + ->join('institution_class_grades', function($join) use ($educationGradeId) { |
|
79 | 79 | $join->on('institution_class_grades.institution_class_id', '=', 'institution_classes.id') |
80 | 80 | ->where('institution_class_grades.education_grade_id', $educationGradeId); |
81 | 81 | }); |
@@ -83,7 +83,7 @@ discard block |
||
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 | } |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @param $year |
96 | 96 | * @param $id |
97 | 97 | */ |
98 | - public function updatePromoted($year, $id){ |
|
99 | - self::where('id',$id)->update(['promoted'=>$year]); |
|
98 | + public function updatePromoted($year, $id) { |
|
99 | + self::where('id', $id)->update(['promoted'=>$year]); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -106,9 +106,9 @@ discard block |
||
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 | /** |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | * @param null $institution |
117 | 117 | * @return mixed |
118 | 118 | */ |
119 | - public function getInstitutionGradeToPromoted($year, $institution = null){ |
|
119 | + public function getInstitutionGradeToPromoted($year, $institution = null) { |
|
120 | 120 | return self::query() |
121 | - ->select('education_grades.name','institutions.code','institutions.name as institution_name','institution_grades.id','institution_grades.institution_id','institution_grades.education_grade_id') |
|
122 | - ->where('promoted','=',$year-1) |
|
123 | - ->join('education_grades','institution_grades.education_grade_id','=','education_grades.id') |
|
124 | - ->join('institutions', function($join) use ($year,$institution){ |
|
125 | - $join->on('institutions.id','=','institution_grades.institution_id') |
|
126 | - ->where('institutions.code','=',$institution); |
|
121 | + ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
|
122 | + ->where('promoted', '=', $year - 1) |
|
123 | + ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
|
124 | + ->join('institutions', function($join) use ($year, $institution){ |
|
125 | + $join->on('institutions.id', '=', 'institution_grades.institution_id') |
|
126 | + ->where('institutions.code', '=', $institution); |
|
127 | 127 | }) |
128 | 128 | ->orderBy('institution_id') |
129 | 129 | ->get()->toArray(); |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @param $year |
134 | 134 | * @return mixed |
135 | 135 | */ |
136 | - public function getInstitutionGradeList($year){ |
|
136 | + public function getInstitutionGradeList($year) { |
|
137 | 137 | return self::query() |
138 | - ->select('education_grades.name','institutions.code','institutions.name as institution_name','institution_grades.id','institution_grades.institution_id','institution_grades.education_grade_id') |
|
139 | - ->where('promoted','=',$year-1) |
|
140 | - ->join('education_grades','institution_grades.education_grade_id','=','education_grades.id') |
|
138 | + ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
|
139 | + ->where('promoted', '=', $year - 1) |
|
140 | + ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
|
141 | 141 | ->join('institutions', function($join) use ($year){ |
142 | - $join->on('institutions.id','=','institution_grades.institution_id'); |
|
142 | + $join->on('institutions.id', '=', 'institution_grades.institution_id'); |
|
143 | 143 | }) |
144 | 144 | ->orderBy('institution_id') |
145 | 145 | ->get()->first(); |
@@ -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 | } |
@@ -71,21 +71,21 @@ |
||
71 | 71 | */ |
72 | 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(){ |
|
83 | + public function student(){ |
|
84 | 84 | return $this->belongsTo('App\Models\Security_user','student_id'); |
85 | 85 | } |
86 | 86 | |
87 | 87 | public static function getStudentsCount(){ |
88 | - $total_male_students = self::with(['student' => function($query) { |
|
88 | + $total_male_students = self::with(['student' => function($query) { |
|
89 | 89 | $query->where('student.gender_id', '=', 1); |
90 | 90 | }])->whereHas('student', function ($query) { |
91 | 91 | $query->where('gender_id', '=', 1); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | use Webpatser\Uuid\Uuid; |
8 | 8 | |
9 | -class Institution_subject_student extends Model { |
|
9 | +class Institution_subject_student extends Model { |
|
10 | 10 | |
11 | 11 | |
12 | 12 | public const CREATED_AT = 'created'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public static function boot() |
52 | 52 | { |
53 | 53 | parent::boot(); |
54 | - self::creating(function ($model) { |
|
54 | + self::creating(function($model) { |
|
55 | 55 | $model->id = (string) Uuid::generate(4); |
56 | 56 | }); |
57 | 57 | |
@@ -69,31 +69,31 @@ discard block |
||
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 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_student_admission extends Base_Model { |
|
7 | +class Institution_student_admission extends Base_Model { |
|
8 | 8 | |
9 | 9 | public const CREATED_AT = 'created'; |
10 | 10 |
@@ -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_grade extends Base_Model { |
|
8 | +class Institution_class_grade extends Base_Model { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * The database table used by the model. |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough |
48 | 48 | */ |
49 | - public function educationSubject(){ |
|
50 | - return $this->hasManyThrough('App\Models\Education_grades_subject','App\Models\Institution_subject', |
|
51 | - 'education_subject_id' ,'education_subject_id'); |
|
49 | + public function educationSubject() { |
|
50 | + return $this->hasManyThrough('App\Models\Education_grades_subject', 'App\Models\Institution_subject', |
|
51 | + 'education_subject_id', 'education_subject_id'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public static function boot() |
71 | 71 | { |
72 | 72 | parent::boot(); |
73 | - self::creating(function ($model) { |
|
73 | + self::creating(function($model) { |
|
74 | 74 | $model->id = (string) Uuid::generate(4); |
75 | 75 | }); |
76 | 76 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
81 | 81 | */ |
82 | - public function classes(){ |
|
83 | - return $this->belongsTo('App\Models\Institution_grade','institution_class_id','id'); |
|
82 | + public function classes() { |
|
83 | + return $this->belongsTo('App\Models\Institution_grade', 'institution_class_id', 'id'); |
|
84 | 84 | } |
85 | 85 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_class extends Base_Model { |
|
7 | +class Institution_class extends Base_Model { |
|
8 | 8 | |
9 | 9 | public const CREATED_AT = 'created'; |
10 | 10 | public const UPDATED_AT = 'modified'; |
@@ -48,22 +48,22 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected $dates = ['modified', 'created']; |
50 | 50 | |
51 | - public function class_teacher(){ |
|
52 | - return $this->belongsTo('App\Models\Security_group_user','staff_id','security_user_id'); |
|
51 | + public function class_teacher() { |
|
52 | + return $this->belongsTo('App\Models\Security_group_user', 'staff_id', 'security_user_id'); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function institution(){ |
|
56 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
55 | + public function institution() { |
|
56 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | - public function getShiftClasses($shift){ |
|
60 | + public function getShiftClasses($shift) { |
|
61 | 61 | return self::query() |
62 | - ->select('institution_classes.id','institution_classes.institution_id','institution_classes.institution_shift_id', |
|
63 | - 'institution_classes.name','institution_classes.no_of_students','institution_classes.class_number','institution_class_grades.education_grade_id') |
|
64 | - ->where('institution_shift_id',$shift) |
|
62 | + ->select('institution_classes.id', 'institution_classes.institution_id', 'institution_classes.institution_shift_id', |
|
63 | + 'institution_classes.name', 'institution_classes.no_of_students', 'institution_classes.class_number', 'institution_class_grades.education_grade_id') |
|
64 | + ->where('institution_shift_id', $shift) |
|
65 | 65 | // ->where('academic_period_id',$academicPeriod) |
66 | - ->join('institution_class_grades','institution_classes.id','institution_class_grades.institution_class_id') |
|
66 | + ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id') |
|
67 | 67 | ->groupBy('institution_classes.id') |
68 | 68 | ->get()->toArray(); |
69 | 69 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Area extends Model { |
|
7 | +class Area extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class User_contact extends Base_Model { |
|
7 | +class User_contact extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | - public static function createOrUpdate($data,$user){ |
|
44 | + public static function createOrUpdate($data, $user) { |
|
45 | 45 | |
46 | - if(!is_null($data['contact'])){ |
|
46 | + if (!is_null($data['contact'])) { |
|
47 | 47 | $exists = self::where('security_user_id', $data->id) |
48 | - ->where('value',$data['contact']) |
|
48 | + ->where('value', $data['contact']) |
|
49 | 49 | ->first(); |
50 | 50 | |
51 | - if(is_null($exists)){ |
|
51 | + if (is_null($exists)) { |
|
52 | 52 | $data = [ |
53 | 53 | 'security_user_id' => $data->id, |
54 | 54 | 'value' => $data['contact'], |
@@ -58,7 +58,7 @@ discard block |
||
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']; |
@@ -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']; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Upload extends Model { |
|
7 | +class Upload extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | public $timestamps = true; |
45 | 45 | |
46 | - public function user(){ |
|
47 | - return $this->belongsTo('App\Models\Security_user','security_user_id'); |
|
46 | + public function user() { |
|
47 | + return $this->belongsTo('App\Models\Security_user', 'security_user_id'); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function classRoom(){ |
|
51 | - return $this->belongsTo('App\Models\Institution_class','institution_class_id'); |
|
50 | + public function classRoom() { |
|
51 | + return $this->belongsTo('App\Models\Institution_class', 'institution_class_id'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Academic_period extends Base_Model { |
|
7 | +class Academic_period extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected $dates = ['start_date', 'end_date', 'modified', 'created']; |
43 | 43 | |
44 | - public function getAcademicPeriod($year){ |
|
45 | - return self::query()->where('code',$year)->first(); |
|
44 | + public function getAcademicPeriod($year) { |
|
45 | + return self::query()->where('code', $year)->first(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | } |