/**
  * SchoolAndUserBasicInfo constructor.
  * @param $user
  * @param $userId
  * @param $schoolId
  */
 public function __construct()
 {
     $userId = Auth::user()->id;
     $this->userId = $userId;
     $this->user = User::find($userId);
     $this->schoolId = UsersRegisteredToSchool::where('user_id', $userId)->get()->first()->school_id;
     $this->currentSchoolSession = SchoolSession::where('school_id', $this->schoolId)->where('current_session', 1)->get()->first();
     $this->currentSchoolSessionId = $this->currentSchoolSession->id;
 }
 protected function goToAfterSignInAdmin($user_id)
 {
     $userType = RequiredFunctions::checkUserTypeByUserId($user_id);
     if ($userType != Groups::Administrator_Group_ID) {
         return redirect(route('admin-welcome-settings'))->with('global', 'Sorry Something went Wrong. Please try again Later!!');
     }
     $user_registered_to_school = UsersRegisteredToSchool::where('user_id', $user_id)->get()->first();
     if ($user_registered_to_school && $user_registered_to_school->count() > 0) {
         $school_session = SchoolSession::where('school_id', '=', $user_registered_to_school->school_id)->where('current_session', '=', 1)->get()->first();
         if ($school_session && $school_session->count() > 0) {
             if ($this->userLoginInfo(Auth::user()->id, $user_registered_to_school->school_id)) {
                 return redirect(route('admin-home'));
             }
         } else {
             return redirect(route('admin-class-set-initial'))->with('global', 'Loggedin Successfully. You Have to Register For new School Session first');
         }
     } else {
         return redirect(route('admin-welcome-settings'));
     }
     return redirect(route('account-admin-sign-in'))->with('global', 'Sorry Something went Wrong. Please try again Later!!');
 }
 public function checkIfCurrentSessionSet()
 {
     $school_session = SchoolSession::where('school_id', $this->getSchoolAndUserBasicInfo()->getSchoolId())->where('current_session', 1)->get()->first();
     return ApiResponseClass::successResponse($school_session->id);
 }