@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Education_grade extends Model { |
|
7 | +class Education_grade extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | - public function getNextGrade($gradeId,$getNextProgrammeGrades = false, $firstGradeOnly = false){ |
|
44 | + public function getNextGrade($gradeId, $getNextProgrammeGrades = false, $firstGradeOnly = false) { |
|
45 | 45 | if (!empty($gradeId)) { |
46 | 46 | $gradeObj = $this->find($gradeId); |
47 | 47 | $programmeId = $gradeObj->education_programme_id; |
48 | 48 | $order = $gradeObj->order; |
49 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
50 | - )->where('order',$order+1)->get()->first(); |
|
49 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
50 | + )->where('order', $order + 1)->get()->first(); |
|
51 | 51 | $nextProgramme = self::getNextProgrammeList($programmeId); |
52 | - if(empty($gradeOptions) && !is_null($nextProgramme)){ |
|
52 | + if (empty($gradeOptions) && !is_null($nextProgramme)) { |
|
53 | 53 | $programmeId = $nextProgramme->next_programme_id; |
54 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
54 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
55 | 55 | )->get()->first(); |
56 | 56 | } |
57 | 57 | // Default is to get the list of grades with the next programme grades |
@@ -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 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | foreach ($nextProgrammeList as $nextProgrammeId) { |
80 | 80 | $nextProgrammeGradeResults = self:: |
81 | - where('education_programme_id',$nextProgrammeId->next_programme_id)->get()->toArray(); |
|
81 | + where('education_programme_id', $nextProgrammeId->next_programme_id)->get()->toArray(); |
|
82 | 82 | |
83 | 83 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
84 | 84 | } |
85 | - } else { |
|
85 | + }else { |
|
86 | 86 | $results = []; |
87 | 87 | } |
88 | 88 | |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | $nextProgrammeList = $this->getNextProgrammeList($id); |
102 | 102 | if (!empty($nextProgrammeList)) { |
103 | - $results = self::whereIn('education_programme_id',$nextProgrammeList) |
|
103 | + $results = self::whereIn('education_programme_id', $nextProgrammeList) |
|
104 | 104 | ->get()->toArray(); |
105 | - } else { |
|
105 | + }else { |
|
106 | 106 | $results = []; |
107 | 107 | } |
108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return array List of next education programmes id |
117 | 117 | */ |
118 | 118 | public function getNextProgrammeList($id) { |
119 | - return Education_programmes_next_programme::where('education_programme_id',$id) |
|
119 | + return Education_programmes_next_programme::where('education_programme_id', $id) |
|
120 | 120 | ->get()->first(); |
121 | 121 | } |
122 | 122 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | use Illuminate\Support\Facades\Auth; |
8 | 8 | |
9 | -class Base_Model extends Model{ |
|
9 | +class Base_Model extends Model { |
|
10 | 10 | |
11 | 11 | |
12 | 12 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | parent::boot(); |
21 | - self::creating(function ($model) { |
|
21 | + self::creating(function($model) { |
|
22 | 22 | $model->created = Carbon::now(); |
23 | 23 | }); |
24 | - self::updating(function ($model) { |
|
24 | + self::updating(function($model) { |
|
25 | 25 | $model->modified = Carbon::now(); |
26 | 26 | }); |
27 | 27 | } |
@@ -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,11 +42,11 @@ 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 | // ->using('App\Models\Institution_subject','institution_subjects.education_subject_id','education_grades_subjects.education_subject_id'); |
52 | 52 | // return $this->belongsToMany('App\Models\Education_grades_subject','institution_subjects','education_subject_id') |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | // }); |
60 | 60 | } |
61 | 61 | |
62 | - public function institutionOptionalSubject(){ |
|
63 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
62 | + public function institutionOptionalSubject() { |
|
63 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
64 | 64 | ->with('institutionGradeSubject') |
65 | - ->whereHas('institutionGradeSubject', function ($query) { |
|
66 | - $query->where('auto_allocation',0); |
|
65 | + ->whereHas('institutionGradeSubject', function($query) { |
|
66 | + $query->where('auto_allocation', 0); |
|
67 | 67 | }); |
68 | 68 | |
69 | 69 | } |
@@ -71,23 +71,23 @@ discard block |
||
71 | 71 | public static function boot() |
72 | 72 | { |
73 | 73 | parent::boot(); |
74 | - self::creating(function ($model) { |
|
74 | + self::creating(function($model) { |
|
75 | 75 | $model->id = (string) Uuid::generate(4); |
76 | 76 | }); |
77 | 77 | } |
78 | 78 | |
79 | - public function institutionSubject(){ |
|
80 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
79 | + public function institutionSubject() { |
|
80 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
81 | 81 | ->with('institutionGradeSubject'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - public static function getMandetorySubjects($institutionClass){ |
|
85 | + public static function getMandetorySubjects($institutionClass) { |
|
86 | 86 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first(); |
87 | 87 | $mandatorySubject = Institution_class_subject::with(['institutionSubject']) |
88 | - ->whereHas('institutionSubject', function ($query) use ($institutionGrade) { |
|
89 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
90 | - $query->where('auto_allocation',1); |
|
88 | + ->whereHas('institutionSubject', function($query) use ($institutionGrade) { |
|
89 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
90 | + $query->where('auto_allocation', 1); |
|
91 | 91 | })->where('education_grade_id', $institutionGrade->education_grade_id); |
92 | 92 | // ->where('auto_allocation', $institutionGrade->education_grade_id); |
93 | 93 | }) |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | $data = []; |
101 | 101 | foreach ($subjects as $subject) { |
102 | 102 | $subjectId = Institution_class_subject::with(['institutionSubject']) |
103 | - ->whereHas('institutionSubject', function ($query) use ($row, $subject, $student) { |
|
104 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
105 | - $query->where('auto_allocation',0); |
|
103 | + ->whereHas('institutionSubject', function($query) use ($row, $subject, $student) { |
|
104 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
105 | + $query->where('auto_allocation', 0); |
|
106 | 106 | }) |
107 | 107 | ->where('name', '=', $row[$subject]) |
108 | 108 | ->where('education_grade_id', '=', $student->education_grade_id); |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | return $data; |
116 | 116 | } |
117 | 117 | |
118 | - public function getInstitutionClassSubjects($academicPeriodId,$classIds){ |
|
118 | + public function getInstitutionClassSubjects($academicPeriodId, $classIds) { |
|
119 | 119 | return self::query() |
120 | - ->whereIn('institution_class_id',$classIds) |
|
120 | + ->whereIn('institution_class_id', $classIds) |
|
121 | 121 | ->get() |
122 | 122 | ->toArray(); |
123 | 123 | } |
124 | 124 | |
125 | - public function isDuplicated($subject){ |
|
126 | - return self::query()->where('institution_subject_id',$subject['institution_subject_id']) |
|
127 | - ->where('institution_class_id',$subject['institution_class_id'])->exists(); |
|
125 | + public function isDuplicated($subject) { |
|
126 | + return self::query()->where('institution_subject_id', $subject['institution_subject_id']) |
|
127 | + ->where('institution_class_id', $subject['institution_class_id'])->exists(); |
|
128 | 128 | } |
129 | 129 | } |
@@ -109,8 +109,9 @@ |
||
109 | 109 | }) |
110 | 110 | ->where('institution_class_id', '=', $student->institution_class_id) |
111 | 111 | ->get()->toArray(); |
112 | - if (!empty($subjectId)) |
|
113 | - $data[] = $subjectId[0]; |
|
112 | + if (!empty($subjectId)) { |
|
113 | + $data[] = $subjectId[0]; |
|
114 | + } |
|
114 | 115 | } |
115 | 116 | return $data; |
116 | 117 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Special_need_difficulty extends Model { |
|
7 | +class Special_need_difficulty 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 Education_grades_subject extends Model { |
|
7 | +class Education_grades_subject extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function institutionGradeSubject(){ |
|
46 | - return $this->hasMany('App\Models\Institution_subject','education_grade_id','education_grade_id'); |
|
45 | + public function institutionGradeSubject() { |
|
46 | + return $this->hasMany('App\Models\Institution_subject', 'education_grade_id', 'education_grade_id'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | protected $table = 'security_users'; |
24 | 24 | |
25 | 25 | protected $appends = [ |
26 | - 'special_need_name' |
|
26 | + 'special_need_name' |
|
27 | 27 | ]; |
28 | 28 | |
29 | 29 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | |
106 | 106 | |
107 | - public function rules() |
|
107 | + public function rules() |
|
108 | 108 | { |
109 | 109 | return [ |
110 | 110 | 'identity_number' => [ |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public function uploads(){ |
129 | - return $this->hasMany('App\Models\Upload'); |
|
129 | + return $this->hasMany('App\Models\Upload'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function class(){ |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use Webpatser\Uuid\Uuid; |
9 | 9 | |
10 | 10 | |
11 | -class Security_user extends Base_Model { |
|
11 | +class Security_user extends Base_Model { |
|
12 | 12 | |
13 | 13 | public const CREATED_AT = 'created'; |
14 | 14 | public const UPDATED_AT = 'modified'; |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected $casts = []; |
85 | 85 | |
86 | - public function institutionStudents(){ |
|
87 | - return $this->hasOne(Institution_student::class,'student_id'); |
|
86 | + public function institutionStudents() { |
|
87 | + return $this->hasOne(Institution_student::class, 'student_id'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | - public function institutionStudentsClass(){ |
|
92 | + public function institutionStudentsClass() { |
|
93 | 93 | return $this->hasOne(Institution_student::class, 'student_id'); |
94 | 94 | } |
95 | 95 | |
@@ -121,24 +121,24 @@ discard block |
||
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 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | 44 | public function shiftExists($shift){ |
45 | - return self::query() |
|
45 | + return self::query() |
|
46 | 46 | ->where('institution_id',$shift['institution_id']) |
47 | 47 | ->where('location_institution_id',$shift['location_institution_id']) |
48 | 48 | ->where('shift_option_id',$shift['shift_option_id']) |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_shift extends Base_Model { |
|
7 | +class Institution_shift extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,20 +41,20 @@ discard block |
||
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 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Illuminate\Support\Facades\Auth; |
7 | 7 | use Webpatser\Uuid\Uuid; |
8 | 8 | |
9 | -class Institution_class_student extends Model { |
|
9 | +class Institution_class_student extends Model { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * The database table used by the model. |
@@ -51,26 +51,26 @@ 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 | $model->created = now(); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | |
60 | - public function student(){ |
|
61 | - return $this->belongsTo('App\Models\Security_user','student_id'); |
|
60 | + public function student() { |
|
61 | + return $this->belongsTo('App\Models\Security_user', 'student_id'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public static function getStudentsCount($institution_class_id) { |
65 | 65 | $total_male_students = self::with(['student' => function($query) { |
66 | 66 | $query->where('student.gender_id', '=', 1); |
67 | - }])->whereHas('student', function ($query) { |
|
67 | + }])->whereHas('student', function($query) { |
|
68 | 68 | $query->where('gender_id', '=', 1); |
69 | 69 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
70 | 70 | |
71 | 71 | $total_female_students = self::with(['student' => function($query) { |
72 | 72 | $query->where('student.gender_id', '=', 2); |
73 | - }])->whereHas('student', function ($query) { |
|
73 | + }])->whereHas('student', function($query) { |
|
74 | 74 | $query->where('gender_id', '=', 2); |
75 | 75 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
76 | 76 | |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | ]; |
85 | 85 | } |
86 | 86 | |
87 | - public static function isDuplicated($inputs){ |
|
87 | + public static function isDuplicated($inputs) { |
|
88 | 88 | |
89 | - $exists = self::where('student_id','=',$inputs['student_id']) |
|
90 | - ->where('institution_class_id',$inputs['institution_class_id']) |
|
89 | + $exists = self::where('student_id', '=', $inputs['student_id']) |
|
90 | + ->where('institution_class_id', $inputs['institution_class_id']) |
|
91 | 91 | ->count(); |
92 | 92 | |
93 | 93 | return $exists; |
94 | 94 | } |
95 | 95 | |
96 | - public function getStudentNewClass($student){ |
|
96 | + public function getStudentNewClass($student) { |
|
97 | 97 | return self::query() |
98 | - ->where('student_id',$student['student_id']) |
|
99 | - ->join('institution_classes','institution_class_students.institution_class_id','=','institution_classes.id') |
|
98 | + ->where('student_id', $student['student_id']) |
|
99 | + ->join('institution_classes', 'institution_class_students.institution_class_id', '=', 'institution_classes.id') |
|
100 | 100 | ->where('institution_class_students.student_id', $student['student_id']) |
101 | 101 | ->get()->last(); |
102 | 102 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_role extends Model { |
|
7 | +class Security_role extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function securityUsers(){ |
|
46 | - return $this->belongsToMany(Security_group_user::class,'security_group_users','security_group_id','security_group_id'); |
|
45 | + public function securityUsers() { |
|
46 | + return $this->belongsToMany(Security_group_user::class, 'security_group_users', 'security_group_id', 'security_group_id'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 |