public function updateDisplay(Request $request, Teacher $teacher)
 {
     $teacher->display = intval($request->status);
     if ($teacher->save()) {
         return \Response::json(['message' => 'Display status of ' . $teacher->user->name . ' has been updated.'], 200);
     } else {
         return \Response::json(['message' => 'There was some problem at the server side.'], 400);
     }
 }
 /**
  * Remove a teacher
  *
  * @param $id
  * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
  */
 public function removeTeacher($id)
 {
     if ($id != null) {
         Teacher::destroy($id);
     }
     return redirect('admins/manage/teachers');
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request, $id)
 {
     if ($request->ajax()) {
         $teacher = Teacher::find($id);
         return response($teacher);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $teachers = Teacher::topN(6);
     $articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     return response()->view('site.classes', array('teachers' => $teachers, 'other_articles' => $articles, 'categories_in_pane' => $categories_in_pane));
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     //
     $teacher = Teacher::find($id);
     $teachers = Teacher::topN(6);
     $articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     return response()->view('site.teacher', array('teacher' => $teacher, 'teachers' => $teachers, 'other_articles' => $articles, 'categories_in_pane' => $categories_in_pane));
 }
 public function destroy($teacher_id)
 {
     $teacher = Teacher::find($teacher_id);
     if ($teacher) {
         $teacher->courses()->detach();
         $teacher->delete();
         return $this->createSuccessResponse("The teacher with id {$teacher->id} has been updated.", 200);
     }
     return $this->createErrorMessage("The teacher with the specified id does not exists.", 404);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $teachers = Teacher::topN(6);
     $article = Article::find($id);
     $other_articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     $article->content = MyUtil::replace_reference_tag($article->content) ?: $article->content;
     $resp = view('site.article', array('article' => $article, 'teachers' => $teachers, 'other_articles' => $other_articles, 'categories_in_pane' => $categories_in_pane));
     return $resp;
 }
 public function destroy($teacher_id)
 {
     $teacher = Teacher::find($teacher_id);
     if ($teacher) {
         $courses = $teacher->courses;
         if (sizeof($courses) > 0) {
             return $this->createErrorResponse('You can\'t remove a teacher with active courses. Please remove those courses first', 409);
         }
         $teacher->delete();
         return $this->createSuccessResponse("The teacher with id {$teacher_id} has been removed", 200);
     }
     return $this->createErrorResponse('The teacher with the specified id does not exists');
 }
 public function profileTeacherSave(Request $request)
 {
     $rules = ['state' => 'required', 'city' => 'required', 'locality' => 'required', 'subject_tution' => 'required', 'experience' => 'required', 'language_medium' => 'required', 'message' => 'required|Max:200'];
     $messages = ['locality.required' => 'Please Enter Your Locality.', 'study_in.required' => 'Please Enter Your Study Subject.', 'experience.required' => 'Please Enter Your Experience years and Where.'];
     $validator = Validator::make($request->all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator);
     } else {
         Teacher::create(['state' => $request->input('state'), 'city' => $request->input('city'), 'locality' => $request->input('locality'), 'subject_tution' => $request->input('subject_tution'), 'other_subject' => $request->input('other_subject'), 'experience' => $request->input('experience'), 'language_medium' => $request->input('language_medium'), 'message' => $request->input('message')]);
     }
     Session::flash('success', 'Teacher Profile Saved!');
     return Redirect::to('student-registration');
 }
Exemple #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Teacher::truncate();
     Student::truncate();
     Course::truncate();
     DB::table('course_student')->truncate();
     factory(Teacher::class, 50)->create();
     factory(Student::class, 500)->create();
     factory(Course::class, 40)->create()->each(function ($course) {
         $course->students()->attach(array_rand(range(1, 500), 40));
     });
     $this->call('OAuthClientSeeder');
 }
 /**
  * Update the password
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Illuminate\Foundation\Validation\ValidationException
  */
 public function updatePassword(Request $request)
 {
     // Validate the password length
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     // Get the currently logged teacher
     $teacher = Teacher::find(Auth::guard('teacher')->user()->facultyId);
     $newPassword = $request['password'];
     $teacher->password = bcrypt($newPassword);
     $teacher->firstLogin = false;
     $teacher->save();
     return redirect('/teachers/home');
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function create(array $data)
 {
     $user_request = UserRequest::where('token', $data['request_token'])->first();
     if ($user_request->role == "Student") {
         $user = Student::where('email', $user_request->email)->first();
     } else {
         if ($user_request->role == "Teacher") {
             $user = Teacher::where('email', $user_request->email)->first();
         }
     }
     $newUser = User::create(['name' => $user->name, 'email' => $user->email, 'password' => bcrypt($data['password'])]);
     $newUser->roles()->attach($user_request->role);
     $user_request->delete();
     return $newUser;
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id, $pageNo)
 {
     //$category = ArticleCategory::with("articles")->find($id);
     $category = ArticleCategory::find($id);
     $teachers = Teacher::topN(6);
     //query()->orderBy('ord_no')->where('in_intro', '1')->take(6)->get();
     $articles = $category->articles()->getResults();
     $other_articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     //dd($categories_in_pane);
     //$articleCnt = $category->articles()->getResults();
     $resp = view('site.category', array('category' => $category, 'teachers' => $teachers, 'articles' => $articles, 'other_articles' => $other_articles, 'categories_in_pane' => $categories_in_pane));
     //$resp = view('site.test', array('category'=>$category, 'teachers'=>$teachers, 'articles'=>$articles));
     return $resp;
 }
 public function destroy($teacher_id, $course_id)
 {
     $teacher = Teacher::find($teacher_id);
     if ($teacher) {
         $course = Course::find($course_id);
         if ($course) {
             if ($teacher->courses()->find($course_id)) {
                 $course->students()->detach();
                 $course->delete();
                 return $this->createSuccessResponse("The course with id {$course_id} was removed", 200);
             }
             return $this->createSuccessResponse("The course with id {$course_id} was updated", 200);
         }
         return $this->createErrorResponse("The course with the id {$course_id} does not exists", 404);
     }
     return $this->createErrorResponse("The teacher with the id {$teacher_id} does not exists", 404);
 }
 public function save()
 {
     $user_request = new UserRequest();
     $user_request->token = bin2hex(random_bytes(15));
     $user_request->role = $this->string;
     $user_request->email = $this->email;
     $user_request->save();
     if ($this->string == 'Student') {
         $user = Student::where('email', $this->email)->first();
     } elseif ($this->string == 'Teacher') {
         $user = Teacher::where('email', $this->email)->first();
     }
     Mail::send('emails.reminder', ['user' => $user_request], function ($m) use($user) {
         $m->from('*****@*****.**', 'Your Account');
         $m->to($user->email, $user->name)->subject('Set up your account!');
     });
 }
 public function postUpdateSubject($scode)
 {
     //Moin
     //Subject Update post Function For admin
     //return $scode;
     $teacher = Input::get('subteacher');
     $class = Input::get('subclass');
     $teacher_name = Teacher::where('teacher_id', '=', $teacher)->pluck('teacher_id');
     $class_name = ClassAdd::where('class_id', '=', $class)->pluck('class_name');
     //return $class;
     $subname = Input::get('subname');
     $subcode = Input::get('subcode');
     $subclass = Input::get('subclass');
     $subclass = $class_name;
     $subteacher = Input::get('subteacher');
     $teacher_name = $teacher_name;
     $subauth = Input::get('subauth');
     $subnote = Input::get('note');
     //return $subname.$subcode.$subclass.$class_name.$subteacher.$teacher_name.$subauth.$subnote;
     $subupdate = Subject::where('institute_code', '=', Auth::user()->institute_id)->where('subject_code', '=', $scode)->update(['subject_name' => $subname, 'subject_code' => $subcode, 'class_name' => $subclass, 'class_id' => $class, 'teacher_name' => $subteacher, 'teacher_id' => $teacher_name, 'sub_author' => $subauth, 'note' => $subnote]);
     Session::flash('data', 'Data successfully added !');
     return Redirect::to('admin/edit/subject/' . $scode);
 }
 /**
  * unAssign all courses
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function unAssignCourse(Request $request)
 {
     if ($request->ajax()) {
         DB::table('courses')->update(['isAssigned' => 1]);
         $teachers = Teacher::all();
         foreach ($teachers as $teacher) {
             $teacher->remaining_credit = $teacher->assigned_credit;
             $teacher->save();
         }
         $request->session()->flash('status', 'Course was unAssigned successfully!');
         return response()->json(['message' => 'Successful']);
     }
 }
 public function instituteReport($Iid)
 {
     /****Admin****/
     $today = date('Y-m-d');
     $y = date("Y");
     //return $today;
     $totalStudents = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->count();
     $totalStudentsMale = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->where('gender', '=', 'Male')->count();
     $totalStudentsFemale = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->where('gender', '=', 'Female')->count();
     $totalTeachesrs = Teacher::where('institute_code', '=', $Iid)->count();
     $teacherAttendence = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Teacher')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$today}%")->count();
     $teacherAttendence1 = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Teacher')->where('status', '=', 1)->where('created_at', 'LIKE', "%{$today}%")->count();
     $total = $teacherAttendence + $teacherAttendence1;
     //return $total;
     $today_atten = (int) ($total / $totalTeachesrs * 100);
     //return $today_atten;
     $a1 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$y}%")->where('type', '=', 'Teacher')->where('status', '=', 1)->count();
     $a0 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$y}%")->where('type', '=', 'Teacher')->where('status', '=', 0)->count();
     $ay = $a1 + $a0;
     //return $ay;
     if ($y % 4 == 0) {
         $x = 366;
         $year_percent = (int) ($ay / $x * 100);
     } else {
         $yx = 365;
         $year_percent = (int) ($ay / $yx * 100);
     }
     //return $atten_percent;
     // return $AtotalInstitute;
     $totalTeacherMale = Teacher::where('institute_code', '=', $Iid)->where('gender', '=', 'Male')->count();
     $totalTeacherFemale = Teacher::where('institute_code', '=', $Iid)->where('gender', '=', 'Female')->count();
     $m = date("Y-m");
     ///$h=Holyday::where('holiday_date','LIKE',"%2016-03%")->get();
     //$h=Holyday::where('holiday_date','LIKE',"%$m%")->get();
     $d = date('t');
     $at = Holyday::where('holiday_date', 'LIKE', "%{$m}%")->count();
     $p = $d - $at;
     //return $p;
     $a12 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$m}%")->where('type', '=', 'Teacher')->where('status', '=', 1)->count();
     $a02 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$m}%")->where('type', '=', 'Teacher')->where('status', '=', 0)->count();
     $ay2 = $a12 + $a02;
     //return $a12.$a02;
     $t = $totalTeachesrs * $p;
     $ms = (int) ($ay2 / $t * 100);
     $at = Holyday::where('holiday_date', 'LIKE', "%{$m}%")->count();
     $InstiHolyday = InstiHolyday::where('holiday_date', 'LIKE', "%{$m}%")->where('institute_code', '=', $Iid)->count();
     $InstiWeekEnd = AcademicCalender::where('institute_code', '=', $Iid)->pluck('weekendday');
     $WeekEnd1 = str_limit($InstiWeekEnd, 3, '');
     $WeekEnd2 = substr($InstiWeekEnd, 4);
     $WeekEnd3 = substr($InstiWeekEnd, 9);
     //   return date('d', strtotime($WeekEnd1));
     $month = date('m');
     $year = date("Y");
     $start_date = "01-" . $month . "-" . $year;
     $start_time = strtotime($start_date);
     $end_time = strtotime("+1 month", $start_time);
     for ($i = $start_time; $i < $end_time; $i += 86400) {
         $list[] = date('D', $i);
     }
     $p = $d - ($at + $InstiHolyday);
     $ms = (int) ($p / $d * 100);
     //students attendence report saif...
     //today attendence calculation
     $totalStudents = Students::where('institute_code', '=', $Iid)->count();
     $totalstudentsAtten = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Student')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$today}%")->count();
     $studentTodayReport = (int) ($totalstudentsAtten / $totalStudents * 100);
     //monthly calculation
     $stdPrestAve = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Student')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$m}%")->count();
     //$presentPersent= (int)(($stdPrestAve/$p)*100);
     $mtotal = $totalStudents * $p;
     $monthpresentPersent = (int) ($stdPrestAve / $mtotal * 100);
     ///yearly calculation
     return view('superadmin.ListofInstituteReport')->with('totalStudents', $totalStudents)->with('totalTeachesrs', $totalTeachesrs)->with('totalStudentsMale', $totalStudentsMale)->with('totalStudentsFemale', $totalStudentsFemale)->with('today', $today_atten)->with('year', $year_percent)->with('m', $totalTeacherMale)->with('f', $totalTeacherFemale)->with('mon', $ms)->with('studentTodayReport', $studentTodayReport)->with('monthpresentPersent', $monthpresentPersent);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     DB::connection()->getPdo()->beginTransaction();
     try {
         $teachers = Teacher::find($id);
         $resId = $teachers->photo;
         $teachers->delete();
         UploadedRes::destroy($resId);
         DB::connection()->getPdo()->commit();
         return response()->json(array("ok" => 1), 200, ['Content-Type:text/json;charset=UTF-8']);
     } catch (\PDOException $e) {
         DB::connection()->getPdo()->rollback();
         return response()->json(array("ok" => 0), 500, ['Content-Type:text/json;charset=UTF-8']);
     }
 }
 /**
  * Update user password
  *
  * @param Request $request
  * @return mixed
  */
 public function updatePassword(Request $request)
 {
     // Get the logged in user
     $teacher = Teacher::find(Auth::guard('teacher')->user()->facultyId);
     $newPassword = $request['password'];
     // Validate the password
     $this->validate($request, ['password' => 'required|min:8']);
     // Save updated password
     $teacher->password = bcrypt($newPassword);
     $teacher->save();
     return redirect()->back()->with('status', 'Success');
 }
 public function getMymenshinghThana($dis)
 {
     /* Current Month Total Day Count Start */
     $date = new \DateTime("-6");
     $date->modify("-" . ($date->format('j') - 1) . " days");
     $month = date('m');
     $year = date("Y");
     $start_date = "01-" . $month . "-" . $year;
     $start_time = strtotime($start_date);
     $end_time = strtotime("+1 month", $start_time);
     for ($i = $start_time; $i < $end_time; $i += 86400) {
         $list[] = date('Y-m-d', $i);
         $list1[] = date('d D', $i);
     }
     $daycount = count($list);
     /************ Current Month Total Day Count End **************/
     /*********** Current Month Total weekend Count Start ***********/
     $t = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
     $e = date('Y-m-d', mktime(0, 0, 0, date('m') + 1, 0, date('Y')));
     //return $t.'--'.$e;
     $begin = new \DateTime($t);
     $end = new \DateTime($e);
     $interval = new \DateInterval('P1D');
     $daterange = new \DatePeriod($begin, $interval, $end);
     $weekends = [];
     foreach ($daterange as $date) {
         if (in_array($date->format('N'), [5])) {
             $weekends[$date->format('W')][] = $date->format('Y-m-d');
         }
     }
     $week = count($weekends);
     /************ Current Month Total weekend Count End ****************/
     $workday = $daycount - $week;
     /************ Current Month Teacher Attdence Percentage Start ****************/
     $teacher = Teacher::all()->count();
     $allteacherworkday = $workday * $teacher;
     $m = date("Y-m");
     $mymenshinghthana = Thana::where('district_name', '=', $dis)->get();
     return view('admin.reports.thanamymenshingh', ['mymenshinghthana' => $mymenshinghthana, 'allteacherworkday' => $allteacherworkday, 'm' => $m]);
 }
 public function assignTeacher($id, $course_id)
 {
     $teacher = new Teacher();
     $user = User::find($id);
     $school_id = $user->school_id;
     $teacher_id_num = $school_id * 100000;
     $teacher->user_id = $user->id;
     $teacher->teacher_id = $teacher->increment('teacher_id') + $teacher_id_num;
     $teacher->school_id = $school_id;
     $teacher->account_status = 'assigned';
     $enrollment = $teacher->save();
     if ($enrollment) {
         return $teacher->teacher_id;
     } else {
         return array('success' => false);
     }
 }
 public function postRoutineByClass()
 {
     //Moin
     //Exam routine search Function for admin
     //return 1;
     $class = Input::get('class');
     //return $class;
     if ($class != '') {
         $examname = Exam::where('institute_code', '=', Auth::user()->institute_id)->lists('exam_id', 'exam_name');
         $classname = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->lists('class_id', 'class_name');
         $schedule = ExamSchedule::where('institute_code', '=', Auth::user()->institute_id)->get();
         $teacher = Teacher::where('institute_code', '=', Auth::user()->institute_id)->get();
         $sid = ClassRoutine::where('class_name', 'LIKE', $class)->pluck('institute_code');
         $sat = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SATURDAY')->get();
         $sun = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SUNDAY')->get();
         $mon = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'MONDAY')->get();
         $tue = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'TUESDAY')->get();
         $wed = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'WEDNESDAY')->get();
         $thu = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'THURSDAY')->get();
         $fri = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'FRIDAY')->get();
         $search1 = Section::where('class_name', '=', $class)->where('institute_code', '=', $sid)->orderBy('section_name', 'ASC')->lists('section_category', 'section_name');
         $indsec = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->get();
         //return $indsec;
         return view('admin.addroutine', ['examview' => $examname, 'classview' => $classname, 'examschedule' => $schedule, 'sat' => $sat, 'sun' => $sun, 'mon' => $mon, 'tue' => $tue, 'wed' => $wed, 'thu' => $thu, 'fri' => $fri, 'sec' => $indsec, 'section' => $search1, 'teacher' => $teacher]);
     }
 }
Exemple #24
0
 public function showTeacher($id)
 {
     $teacher = Teacher::find($id);
     if (empty($teacher)) {
         abort(404);
     }
     $section = 'szdw';
     $sort = $teacher->taxonomy;
     $data = ['section' => $section];
     $data = self::equipSort($data, $section, $sort);
     $data['pageTitle'] = $teacher->name;
     $data['name'] = $teacher->name;
     $data['description'] = $teacher->description;
     $data['picture'] = $teacher->picture;
     return view('teacher', $data);
 }
 /**
  * Create a new Teacher instance after a valid registration.
  *
  * @param  array  $data
  * @return Teacher
  */
 protected function create(array $data)
 {
     return Teacher::create(['facultyId' => $data['facultyId'], 'dCode' => $data['dCode'], 'name' => $data['name'], 'email' => $data['email'], 'office' => $data['office'], 'password' => bcrypt($data['password']), 'firstLogin' => true]);
 }
 public function getAll()
 {
     return Teacher::orderBy('created_at', 'desc')->get();
 }
 public function exportPdf($ids = null)
 {
     $ids = explode(',', substr($ids, 0, -1));
     $ids = array_unique($ids);
     $model = Teacher::whereIn('id', $ids)->where('user_id', \Auth::user()->id)->get(['nom_teacher', 'fonction', 'poste']);
     Excel::create('La liste des Professeurs et RH', function ($excel) use($model, $ids) {
         $excel->sheet('La liste des Professeurs et RH', function ($sheet) use($model, $ids) {
             $sheet->fromModel($model);
             $sheet->setAllBorders('thin');
             $sheet->setFontFamily('OpenSans');
             $sheet->setFontSize(13);
             $sheet->setFontBold(false);
             $sheet->setAllBorders('thin');
             for ($i = 1; $i <= count($ids) + 1; $i++) {
                 $sheet->setHeight($i, 25);
                 $sheet->row($i, function ($rows) {
                     $rows->setFontColor('#556b7b');
                     $rows->setAlignment('center');
                 });
                 $sheet->cells('A' . $i . ':' . 'C' . $i, function ($cells) {
                     $cells->setValignment('middle');
                     $cells->setFontColor('#556b7b');
                     $cells->setFont(array('family' => 'OpenSans', 'size' => '13', 'bold' => false));
                 });
             }
             // normal header
             $sheet->cells('A1:C1', function ($cells) {
                 $cells->setBackground('#e9f1f3');
                 $cells->setFontColor('#556b7b');
                 $cells->setFont(array('family' => 'OpenSans', 'size' => '15', 'bold' => true));
             });
             $sheet->row(1, array('Nom Complet', 'Fonction', 'Poste'));
         });
     })->export('pdf');
 }
 public function getTeacherAttdenceAllReport($tid)
 {
     $AppWE = AcademicCalender::where('institute_code', '=', Auth::user()->institute_id)->pluck('weekendday');
     $tpinfo = Teacher::where('institute_code', '=', Auth::user()->institute_id)->where('teacher_id', '=', $tid)->first();
     $App = str_limit($AppWE, 3, '');
     $sewe = substr($AppWE, 4);
     $sewe3 = substr($AppWE, 9);
     $month = Input::get('month');
     //  return $month;
     $year = date("Y");
     $start_date = "01-" . $month . "-" . $year;
     $start_time = strtotime($start_date);
     //return $start_time;
     $end_time = strtotime("+1 month", $start_time);
     for ($i = $start_time; $i < $end_time; $i += 86400) {
         $list[] = date('l', $i);
         $list1[] = date('Y-m-d', $i);
     }
     //return $list1;
     return view('admin.attendence.individualteacherreport', ['pre' => $list1, 'day' => $list, 'teacher' => $tpinfo, 'App' => $App, 'sewe' => $sewe, 'sewe3' => $sewe3]);
 }
 public function deleteTeachersInfo($uid)
 {
     //Moin
     //Student Delete Function for admin
     $infoDelete = Teacher::where('institute_code', '=', Auth::user()->institute_id)->where('teacher_id', '=', $uid)->delete();
     $infoDelete = User::where('institute_id', '=', Auth::user()->institute_id)->where('uid', '=', $uid)->delete();
     Session::flash('data', 'Data successfully deleted !');
     return Redirect::to('/admin/add/teacher');
 }
 /**
  * Set / update teachers semester
  *
  * @param Request $request
  * @return mixed
  */
 public function addSemester(Request $request)
 {
     if (!$this->isRegistrationActive('staff')) {
         return view($this->inactiveView);
     }
     $this->validate($request, ['semNo' => 'required|numeric|min:1|unique:teachers,semNo,NULL,id,dCode,' . Auth::guard('teacher')->user()->dCode], ['unique' => 'This semester is already allocated']);
     $semNo = $request['semNo'];
     $teacher = Teacher::find(Auth::guard('teacher')->user()->facultyId);
     $teacher->semNo = $semNo;
     $teacher->save();
     return redirect()->back();
 }