TeacherHomeController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\User;
  5. use App\StudentProposal;
  6. use App\Models\Department;
  7. use App\Models\ReferUser;
  8. use App\Models\University;
  9. use App\Models\Requirement;
  10. use App\Institution;
  11. use App\Workexperience;
  12. use Auth;
  13. class TeacherHomeController extends Controller
  14. {
  15. public function __construct()
  16. {
  17. $this->middleware('teacher');
  18. }
  19. public function teacher_profile(Request $request)
  20. { $user = Auth::guard('teacher')->user();
  21. $students = StudentProposal::where(
  22. 'teacher_id',$user->id
  23. )->where(
  24. 'proposal_submit_status',1
  25. )->get();
  26. $departments =Department::where('status',1)->orderBy('name','ASC')->get();
  27. // $refer_users =ReferUser::where('teacher_id',$user->id)->orderBy('id','DESC')->get();
  28. $refer_users =User::where(
  29. 'wishlist_teacher_id',$user->id
  30. )->whereIn(
  31. 'register_type',[3,4] // 3=q_form; 4= wishlist
  32. )->orderBy('id','DESC')->get();
  33. $universities =University::orderBy('name','ASC')->get();
  34. return view('teacher_profile',compact('students','user','departments','refer_users','universities'));
  35. }
  36. public function student_proposal_details($id){
  37. $user = Auth::guard('teacher')->user();
  38. $proposal_details = StudentProposal::find($id);
  39. $education_history =Institution::where(
  40. 'student_id',$proposal_details->student_id
  41. )->orderBy('id','desc')->get();
  42. $experience =Workexperience::where(
  43. 'student_id',$proposal_details->student_id
  44. )->get();
  45. if(isset($experience)){
  46. $work_experince =[];
  47. foreach($experience as $key=>$row){
  48. array_push($work_experince,$row->start_date);
  49. array_push($work_experince,$row->end_date);
  50. }
  51. $start_date = current($work_experince);
  52. $end_date = end($work_experince);
  53. }
  54. $doc_info =Requirement::where(
  55. 'std_proposal_id',$proposal_details->id
  56. )->get();
  57. return view('teacher.student_proposal_details',compact('proposal_details','education_history','start_date','end_date','doc_info'));
  58. }
  59. }