@@ -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 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Import_mapping extends Model { |
|
7 | +class Import_mapping extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | protected $dates = []; |
43 | 43 | |
44 | 44 | |
45 | - public static function getSheetColumns($model = null){ |
|
45 | + public static function getSheetColumns($model = null) { |
|
46 | 46 | $columns = Import_mapping::where('model', '=', $model) |
47 | 47 | ->orderBy('order') |
48 | 48 | ->get()->toArray(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | use Illuminate\Database\Eloquent\Model; |
8 | 8 | |
9 | 9 | |
10 | -class Education_programmes_next_programme extends Model { |
|
10 | +class Education_programmes_next_programme extends Model { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * The database table used by the model. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $institution = Institution_class::find($file['institution_class_id']); |
25 | 25 | |
26 | 26 | $this->user = User::find($file['security_user_id']); |
27 | - $this->subject = 'SIS Bulk upload: '. $file['subject'] .$institution->institution->code.': '. $institution->name.' ' . date('Y:m:d H:i:s'); |
|
27 | + $this->subject = 'SIS Bulk upload: '.$file['subject'].$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
28 | 28 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
29 | 29 | $this->from_name = 'SIS Bulk Uploader'; |
30 | 30 | $this->with = [ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function build() |
46 | 46 | { |
47 | 47 | return $this->view('emails.mail') |
48 | - ->from($this->from_address,$this->from_name) |
|
48 | + ->from($this->from_address, $this->from_name) |
|
49 | 49 | ->to($this->user->email) |
50 | 50 | ->subject($this->subject) |
51 | 51 | ->with($this->with); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | public function check($value, $hashedValue, array $options = []) |
15 | 15 | { |
16 | - return password_verify ($value , $hashedValue); |
|
16 | + return password_verify($value, $hashedValue); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | public function make($value, array $options = []) |
21 | 21 | { |
22 | - return password_hash($value,PASSWORD_DEFAULT,$options); |
|
22 | + return password_hash($value, PASSWORD_DEFAULT, $options); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function needsRehash($hashedValue, array $options = []) |
29 | 29 | { |
30 | - return password_needs_rehash($hashedValue,$options); |
|
30 | + return password_needs_rehash($hashedValue, $options); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 |
@@ -52,9 +52,9 @@ |
||
52 | 52 | $value = self::where('st_no', $data['st_no'])->get(); |
53 | 53 | if (count($value) > 0) { |
54 | 54 | self::where('st_no', $data['st_no'])->update($data); |
55 | - } else { |
|
55 | + }else { |
|
56 | 56 | self::insert($data); |
57 | 57 | } |
58 | - $output->writeln('Student name: ' . ($data['f_name']) . ' has been inserted to the database'); |
|
58 | + $output->writeln('Student name: '.($data['f_name']).' has been inserted to the database'); |
|
59 | 59 | } |
60 | 60 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | */ |
16 | 16 | public function handle($request, Closure $next) |
17 | 17 | { |
18 | - if($request->user()->super_admin == 1){ |
|
18 | + if ($request->user()->super_admin == 1) { |
|
19 | 19 | return $next($request); |
20 | - }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
20 | + }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
21 | 21 | return $next($request); |
22 | - }elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
22 | + }elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
23 | 23 | return $next($request); |
24 | - }elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
24 | + }elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
25 | 25 | return $next($request); |
26 | 26 | } |
27 | 27 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |