@@ -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 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Institution_subject extends Base_Model { |
|
| 7 | +class Institution_subject extends Base_Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | protected $dates = ['modified', 'created', 'modified', 'created']; |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - public function institutionGradeSubject(){ |
|
| 46 | - return $this->belongsTo('App\Models\Education_grades_subject','education_subject_id','education_subject_id'); |
|
| 45 | + public function institutionGradeSubject() { |
|
| 46 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_subject_id', 'education_subject_id'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function institutionOptionalGradeSubject(){ |
|
| 50 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
| 49 | + public function institutionOptionalGradeSubject() { |
|
| 50 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function institutionMandatoryGradeSubject(){ |
|
| 54 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
| 53 | + public function institutionMandatoryGradeSubject() { |
|
| 54 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | - public function institutionClassSubject(){ |
|
| 59 | - return $this->hasMany('App\Models\Institution_class_subject','institution_class_id','id'); |
|
| 58 | + public function institutionClassSubject() { |
|
| 59 | + return $this->hasMany('App\Models\Institution_class_subject', 'institution_class_id', 'id'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - public function getInstitutionSubjects($institution_id,$academic_period_id){ |
|
| 65 | - return self::query()->where('institution_id',$institution_id) |
|
| 66 | - ->where('academic_period_id',$academic_period_id) |
|
| 64 | + public function getInstitutionSubjects($institution_id, $academic_period_id) { |
|
| 65 | + return self::query()->where('institution_id', $institution_id) |
|
| 66 | + ->where('academic_period_id', $academic_period_id) |
|
| 67 | 67 | ->get()->toArray(); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Security_group extends Model { |
|
| 7 | +class Security_group extends Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | // return $this->hasMany( User::class); |
| 46 | 46 | // } |
| 47 | 47 | |
| 48 | - public function security_users(){ |
|
| 49 | - return $this->belongsTo('App\Models\Security_group_user','security_group_id'); |
|
| 48 | + public function security_users() { |
|
| 49 | + return $this->belongsTo('App\Models\Security_group_user', 'security_group_id'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | - public function security_group_institution(){ |
|
| 54 | - return $this->hasMany('App\Models\Security_group_institution','security_group_id'); |
|
| 53 | + public function security_group_institution() { |
|
| 54 | + return $this->hasMany('App\Models\Security_group_institution', 'security_group_id'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | use Webpatser\Uuid\Uuid; |
| 7 | 7 | |
| 8 | -class User_nationality extends Base_Model { |
|
| 8 | +class User_nationality extends Base_Model { |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * The database table used by the model. |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public static function boot() |
| 48 | 48 | { |
| 49 | 49 | parent::boot(); |
| 50 | - self::creating(function ($model) { |
|
| 50 | + self::creating(function($model) { |
|
| 51 | 51 | $model->id = (string) Uuid::generate(4); |
| 52 | 52 | }); |
| 53 | 53 | |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Area_administrative extends Model { |
|
| 7 | +class Area_administrative 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 Institution extends Model { |
|
| 7 | +class Institution extends Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -41,7 +41,7 @@ discard block |
||
| 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 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use Laravel\Passport\HasApiTokens; |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -class User extends Authenticatable { |
|
| 10 | +class User extends Authenticatable { |
|
| 11 | 11 | |
| 12 | 12 | use HasApiTokens, Notifiable; |
| 13 | 13 | |
@@ -69,32 +69,32 @@ discard block |
||
| 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) { |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Security_group_institution extends Model { |
|
| 7 | +class Security_group_institution extends Model { |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -44,16 +44,16 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function institution(){ |
|
| 48 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
| 47 | + public function institution() { |
|
| 48 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function institution_classes(){ |
|
| 52 | - return $this->hasMany('App\Models\Institution_class','institution_id','institution_id'); |
|
| 51 | + public function institution_classes() { |
|
| 52 | + return $this->hasMany('App\Models\Institution_class', 'institution_id', 'institution_id'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function security_group(){ |
|
| 56 | - return $this->belongsTo('App\Models\Security_group','security_group_id'); |
|
| 55 | + public function security_group() { |
|
| 56 | + return $this->belongsTo('App\Models\Security_group', 'security_group_id'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use App\Models\Base_Model; |
| 7 | 7 | use Webpatser\Uuid\Uuid; |
| 8 | 8 | |
| 9 | -class Student_guardian extends Base_Model { |
|
| 9 | +class Student_guardian extends Base_Model { |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | public const CREATED_AT = 'created'; |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | public static function boot() |
| 56 | 56 | { |
| 57 | 57 | parent::boot(); |
| 58 | - self::creating(function ($model) { |
|
| 58 | + self::creating(function($model) { |
|
| 59 | 59 | $model->id = (string) Uuid::generate(4); |
| 60 | 60 | $model->created_user_id = 1; |
| 61 | 61 | }); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public static function createStudentGuardian($student,$guardian,$user){ |
|
| 64 | + public static function createStudentGuardian($student, $guardian, $user) { |
|
| 65 | 65 | |
| 66 | 66 | $data = [ |
| 67 | 67 | 'student_id' => $student->student_id, |