@@ -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 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Identity_type extends Model { |
|
7 | +class Identity_type extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -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 | } |
@@ -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 | } |
@@ -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,19 +42,19 @@ 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 | } |
52 | 52 | |
53 | - public function institutionOptionalSubject(){ |
|
54 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
53 | + public function institutionOptionalSubject() { |
|
54 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
55 | 55 | ->with('institutionGradeSubject') |
56 | - ->whereHas('institutionGradeSubject', function ($query) { |
|
57 | - $query->where('auto_allocation',0); |
|
56 | + ->whereHas('institutionGradeSubject', function($query) { |
|
57 | + $query->where('auto_allocation', 0); |
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | } |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | public static function boot() |
63 | 63 | { |
64 | 64 | parent::boot(); |
65 | - self::creating(function ($model) { |
|
65 | + self::creating(function($model) { |
|
66 | 66 | $model->id = (string) Uuid::generate(4); |
67 | 67 | }); |
68 | 68 | } |
69 | 69 | |
70 | - public function institutionSubject(){ |
|
71 | - return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id') |
|
70 | + public function institutionSubject() { |
|
71 | + return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id') |
|
72 | 72 | ->with('institutionGradeSubject'); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - public static function getMandetorySubjects($institutionClass){ |
|
76 | + public static function getMandetorySubjects($institutionClass) { |
|
77 | 77 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first(); |
78 | 78 | $mandatorySubject = Institution_class_subject::with(['institutionSubject']) |
79 | - ->whereHas('institutionSubject', function ($query) use ($institutionGrade) { |
|
80 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
81 | - $query->where('auto_allocation',1); |
|
79 | + ->whereHas('institutionSubject', function($query) use ($institutionGrade) { |
|
80 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
81 | + $query->where('auto_allocation', 1); |
|
82 | 82 | })->where('education_grade_id', $institutionGrade->education_grade_id); |
83 | 83 | // ->where('auto_allocation', $institutionGrade->education_grade_id); |
84 | 84 | }) |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | return $mandatorySubject; |
88 | 88 | } |
89 | 89 | |
90 | - public static function getAllSubjects($institutionClass){ |
|
90 | + public static function getAllSubjects($institutionClass) { |
|
91 | 91 | $allSubjects = Institution_class_subject::with(['institutionSubject']) |
92 | - ->whereHas('institutionSubject', function ($query) use ($institutionClass) { |
|
92 | + ->whereHas('institutionSubject', function($query) use ($institutionClass) { |
|
93 | 93 | $query->whereHas('institutionGradeSubject')->where('education_grade_id', $institutionClass['education_grade_id']); |
94 | 94 | }) |
95 | 95 | ->where('institution_class_id', '=', $institutionClass['id']) |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $data = []; |
102 | 102 | foreach ($subjects as $subject) { |
103 | 103 | $subjectId = Institution_class_subject::with(['institutionSubject']) |
104 | - ->whereHas('institutionSubject', function ($query) use ($row, $subject, $student) { |
|
105 | - $query->whereHas('institutionGradeSubject',function($query){ |
|
106 | - $query->where('auto_allocation',0); |
|
104 | + ->whereHas('institutionSubject', function($query) use ($row, $subject, $student) { |
|
105 | + $query->whereHas('institutionGradeSubject', function($query) { |
|
106 | + $query->where('auto_allocation', 0); |
|
107 | 107 | }) |
108 | 108 | ->where('name', '=', $row[$subject]) |
109 | 109 | ->where('education_grade_id', '=', $student->education_grade_id); |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | return $data; |
117 | 117 | } |
118 | 118 | |
119 | - public function getInstitutionClassSubjects($academicPeriodId,$classIds){ |
|
119 | + public function getInstitutionClassSubjects($academicPeriodId, $classIds) { |
|
120 | 120 | return self::query() |
121 | - ->whereIn('institution_class_id',$classIds) |
|
121 | + ->whereIn('institution_class_id', $classIds) |
|
122 | 122 | ->get() |
123 | 123 | ->toArray(); |
124 | 124 | } |
125 | 125 | |
126 | - public function isDuplicated($subject){ |
|
127 | - return self::query()->where('institution_subject_id',$subject['institution_subject_id']) |
|
128 | - ->where('institution_class_id',$subject['institution_class_id'])->get()->toArray(); |
|
126 | + public function isDuplicated($subject) { |
|
127 | + return self::query()->where('institution_subject_id', $subject['institution_subject_id']) |
|
128 | + ->where('institution_class_id', $subject['institution_class_id'])->get()->toArray(); |
|
129 | 129 | } |
130 | 130 | } |
@@ -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 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 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | use Webpatser\Uuid\Uuid; |
7 | 7 | |
8 | -class User_identity extends Model { |
|
8 | +class User_identity extends Model { |
|
9 | 9 | |
10 | 10 | public const CREATED_AT = 'created'; |
11 | 11 | public const UPDATED_AT = 'modified'; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_subjects_room extends Model { |
|
7 | +class Institution_subjects_room extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -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; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class User_special_need extends Base_Model { |
|
7 | +class User_special_need extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,11 +42,11 @@ discard block |
||
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; |