Exemple #1
0
 public static function grantStaff($input)
 {
     foreach ($input['staffs'] as $s) {
         $staff = staff::where('userId', $s)->first();
         $grant = 0;
         if (isset($input['grant'])) {
             if (in_array($s, $input['grant'])) {
                 $grant = 1;
             }
         }
         $staff->grant = $grant;
         $staff->save();
     }
 }
 public static function deleteStaff($staffId)
 {
     $user = user::where('userId', $staffId)->first();
     if ($user->userType == 'doctor') {
         $doctor = doctor::where('userId', $staffId)->first();
         $doctor->delete();
     } else {
         if ($user->userType == 'staff') {
             $staff = staff::where('userId', $staffId)->first();
             $staff->delete();
         }
     }
     $hospitalStaff = hospitalStaff::where('userId', $staffId)->first();
     $hospitalStaff->delete();
     $user->delete();
 }
 public function editStaffProfile(Request $request)
 {
     $input = $request->all();
     $staff = staff::where('userId', Auth::user()->userId)->first();
     $staff->editStaffProfile($input);
     return redirect('staffProfile');
 }