@@ -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. |
@@ -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 | } |
@@ -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. |
@@ -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; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group_user extends Model { |
|
7 | +class Security_group_user extends Model { |
|
8 | 8 | |
9 | 9 | public const CREATED_AT = 'created'; |
10 | 10 | public const UPDATED_AT = 'modified'; |
@@ -45,34 +45,34 @@ discard block |
||
45 | 45 | protected $dates = ['modified', 'created', 'created']; |
46 | 46 | |
47 | 47 | |
48 | - public function security_user(){ |
|
49 | - return $this->belongsToMany('App\Models\User','security_users'); |
|
48 | + public function security_user() { |
|
49 | + return $this->belongsToMany('App\Models\User', 'security_users'); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function security_group(){ |
|
53 | - return $this->hasMany('App\Models\Security_group' , 'id','security_group_id'); |
|
52 | + public function security_group() { |
|
53 | + return $this->hasMany('App\Models\Security_group', 'id', 'security_group_id'); |
|
54 | 54 | } |
55 | 55 | |
56 | - public function security_group_institution(){ |
|
57 | - return $this->belongsTo('App\Models\Security_group_institution','security_group_id','security_group_id'); |
|
56 | + public function security_group_institution() { |
|
57 | + return $this->belongsTo('App\Models\Security_group_institution', 'security_group_id', 'security_group_id'); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function staff_class(){ |
|
61 | - return $this->hasMany('App\Models\Institution_class','staff_id','security_user_id'); |
|
60 | + public function staff_class() { |
|
61 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'security_user_id'); |
|
62 | 62 | } |
63 | 63 | |
64 | - public function institution_staff(){ |
|
65 | - return $this->belongsTo('App\Models\Institution_staff','security_user_id','staff_id'); |
|
64 | + public function institution_staff() { |
|
65 | + return $this->belongsTo('App\Models\Institution_staff', 'security_user_id', 'staff_id'); |
|
66 | 66 | } |
67 | 67 | |
68 | - public function institution_group(){ |
|
69 | - return $this->hasMany('App\Models\Security_group_institution','security_group_id','security_group_id') |
|
70 | - ->with(['institution','institution_classes']); |
|
68 | + public function institution_group() { |
|
69 | + return $this->hasMany('App\Models\Security_group_institution', 'security_group_id', 'security_group_id') |
|
70 | + ->with(['institution', 'institution_classes']); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - public function roles(){ |
|
75 | - return $this->belongsTo('App\Models\Security_role','security_role_id','id'); |
|
74 | + public function roles() { |
|
75 | + return $this->belongsTo('App\Models\Security_role', 'security_role_id', 'id'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 |