예제 #1
0
 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!!');
 }