當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Student::find方法代碼示例

本文整理匯總了PHP中app\Student::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Student::find方法的具體用法?PHP Student::find怎麽用?PHP Student::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Student的用法示例。


在下文中一共展示了Student::find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 public function destroy($student_id)
 {
     $student = Student::find($student_id);
     if ($student) {
         $student->courses()->detach();
         $student->delete();
         return $this->createSuccessResponse("The student with id {$student_id} has been removed", 200);
     }
     return $this->createErrorResponse('The student with the specified id does not exists');
 }
開發者ID:JuanDMeGon,項目名稱:LumenAPI-Eng,代碼行數:10,代碼來源:StudentController.php

示例2: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $students = Student::find($id);
     $faculties = Faculty::lists('faculty_name', 'faculty_code');
     $studies = Study::lists('study_name', 'id');
     $programStudies = ProgramStudy::lists('name', 'id');
     $academicRegistrations = AcademicRegistration::lists('academic_year', 'id');
     $religions = Religion::lists('name', 'id');
     return view('dashboard.admin.student.edit', ['student' => $students, 'faculty' => $faculties, 'study' => $studies, 'programStudy' => $programStudies, 'academicRegistration' => $academicRegistrations, 'religion' => $religions]);
 }
開發者ID:nurulimamnotes,項目名稱:tutasiak,代碼行數:16,代碼來源:StudentController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateParentRequest $request)
 {
     $parent = new Guardian(array('firstname' => $request->firstname, 'lastname' => $request->lastname, 'middlename' => $request->middle_name, 'phone' => $request->phone, 'district' => $request->district, 'home_address' => $request->home_address, 'office_address' => $request->office_address, 'occupation' => $request->occupation, 'email' => $request->email));
     $student = \App\Student::find($request->student_id);
     $parent = $student->guardians()->save($parent, ['relation' => $request->relation]);
     if ($parent) {
         return \Redirect::route('learners')->with('message', 'Parent successfuly registered!');
     } else {
         return \Redirect::route('learners')->with('error-message', 'Failed to register Parent!');
     }
 }
開發者ID:eyamu,項目名稱:sms,代碼行數:16,代碼來源:ParentsController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $student = Student::find($id);
     $student->sernum = $request->sernum;
     $student->category_id = $request->category_id;
     $student->lastname = $request->lastname;
     $student->firstname = $request->firstname;
     $student->email = $request->email;
     $student->sernum = $request->sernum;
     $student->save();
     return redirect()->route('student.index');
 }
開發者ID:pedja260,項目名稱:pedagoska_sveska,代碼行數:19,代碼來源:StudentController.php

示例5: sendVerifiactionMail

 /**
  * This function sends a verification
  * mail with code to the students.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function sendVerifiactionMail()
 {
     // Get currently logged in student
     $student = Student::find(Auth::guard('student')->user()->rollNo);
     $verificationCode = $this->generateVerificationCode($student->rollNo);
     $student->verificationCode = $verificationCode;
     $student->save();
     Mail::queue('student.auth.emails.verification', ['student' => $student], function ($msg) use($student) {
         $msg->from('noreply@semesterregistration.com', 'Support');
         $msg->to($student->email, $student->name)->subject('Your Verification code');
     });
     $statusMsg = 'Verification code successfully sent on ' . $student->email;
     return redirect()->back()->with('status', $statusMsg);
 }
開發者ID:prateekprshr-nith,項目名稱:beautifulCode,代碼行數:20,代碼來源:VerificationController.php

示例6: destroy

 public function destroy($course_id, $student_id)
 {
     $course = Course::find($course_id);
     if ($course) {
         $student = Student::find($student_id);
         if ($student) {
             if (!$course->students()->find($student->id)) {
                 return $this->createErrorResponse("The student with id {$student->id} does not exists in the course with id {$course->id}", 404);
             }
             $course->students()->detach($student->id);
             return $this->createSuccessResponse("The student with id {$student->id} was removed from the course with id {$course->id}", 200);
         }
         return $this->createErrorResponse("The student with id {$student_id} does not exists", 404);
     }
     return $this->createErrorResponse("The course with id {$course_id}, does not exists", 404);
 }
開發者ID:osvaldino,項目名稱:LumenAPI-Eng,代碼行數:16,代碼來源:CourseStudentController.php

示例7: ucenik

 public function ucenik($id)
 {
     //
     $student = Student::find($id);
     $ulogovani_user_id = \Auth::user()->id;
     $odabrani_razred_id = $student->category->id;
     $odabrani_ucenik_id = $student->id;
     $count = Report::where('user_id', '=', $ulogovani_user_id)->where('category_id', '=', $odabrani_razred_id)->where('student_id', '=', $odabrani_ucenik_id)->count();
     if ($count < 1) {
         return view('reports.create')->with('ulogovani_user_id', $ulogovani_user_id)->with('odabrani_razred_id', $odabrani_razred_id)->with('odabrani_ucenik_id', $odabrani_ucenik_id);
         //return $count;
     } else {
         $report = Report::where('user_id', '=', $ulogovani_user_id)->where('category_id', '=', $odabrani_razred_id)->where('student_id', '=', $odabrani_ucenik_id)->first();
         return view('reports.index')->with('report', $report);
     }
 }
開發者ID:pedja260,項目名稱:pedagoska_sveska,代碼行數:16,代碼來源:ReportController.php

示例8: postUpdate

 public function postUpdate(Request $request, $id)
 {
     $inputs = $request->all();
     $rules = ['phone' => 'required'];
     $validator = Validator::make($inputs, $rules);
     if ($validator->passes()) {
         $student = Student::find($id);
         $student->c_lxdh = $inputs['phone'];
         $student->c_zyh = $inputs['major'];
         if ($student->save()) {
             return redirect('/')->with('status', '雙學位報名成功');
         } else {
             return back()->withErrors('雙學位報名失敗');
         }
     } else {
         return back()->withErrors($validator);
     }
 }
開發者ID:rxfu,項目名稱:dualdegree,代碼行數:18,代碼來源:UserController.php

示例9: rollbackLog

 public static function rollbackLog($id, $user, $review_ip)
 {
     $review_at = date('Y-m-d H:i:s', time());
     $update_arr = array('review_name' => $user->name, 'review_email' => $user->email, 'review_ip' => $review_ip, 'review_at' => $review_at, 'review' => true, 'status' => '審核未通過');
     $manage_log = self::find($id);
     $before = json_decode($manage_log->before_info, true);
     $after = json_decode($manage_log->after_info, true);
     //Student
     if ($manage_log->type == "新增信息") {
         $student = Student::find($after['id']);
         if (!$student) {
             return "數據回滾失敗:學號為" . $after['id'] . "的學生已不存在!";
         }
         $student->delete();
     }
     if ($manage_log->type == "修改信息") {
         $data = array();
         foreach ($before as $key => $value) {
             if ($before[$key] != $after[$key]) {
                 $data[$key] = $before[$key];
             }
         }
         $student = Student::find($after['id']);
         if (!$student) {
             return "數據回滾失敗:學號為" . $after['id'] . "的學生已不存在!";
         }
         $student->update($data);
     }
     if ($manage_log->type == "刪除信息") {
         $student = Student::find($before['id']);
         if ($student) {
             return "數據回滾失敗:已存在學號為" . $before['id'] . "的學生!";
         }
         Student::create($before);
     }
     $manage_log->update($update_arr);
 }
開發者ID:ChenPeiyuan,項目名稱:student-infomation-manager,代碼行數:37,代碼來源:StudentManageLog.php

示例10: updatePassword

 /**
  * Update user password
  *
  * @param Request $request
  * @return mixed
  */
 public function updatePassword(Request $request)
 {
     // Get the logged in user
     $student = Student::find(Auth::guard('student')->user()->rollNo);
     $newPassword = $request['password'];
     // Validate the password
     $this->validate($request, ['password' => 'required|min:8']);
     // Save updated password
     $student->password = bcrypt($newPassword);
     $student->save();
     return redirect()->back()->with('status', 'Success');
 }
開發者ID:prateekprshr-nith,項目名稱:sisnew,代碼行數:18,代碼來源:InformationUpdateController.php

示例11: editStudent

 public function editStudent(Request $request)
 {
     $id = $this->clean($request->input('id'));
     $student = Student::find($id);
     return view('student/delete_edit', array('student' => $student));
 }
開發者ID:huynt57,項目名稱:savvy-laravel,代碼行數:6,代碼來源:StudentController.php

示例12: calculateStaffDiscount

 /**
  * @param  int
  * @param  string
  * @return double
  */
 public static function calculateStaffDiscount($student_id, $fee_schedule_code)
 {
     //initialise discount to zero
     $discount = 0;
     //get stuednt info
     $student = Student::find($student_id);
     //get the staff discount value for this fee schedule
     $staff_discount = self::getStaffDiscountAmount($fee_schedule_code);
     //get details of staff discount policy
     $discount_policy = DiscountPolicy::where('discount_name', 'Parent')->first();
     //get all wards with same staff
     $same_staff = Student::select('id')->where('staff_id', $student->staff_id)->get();
     //divide staff discount accross all wards that have thesame staff
     if ($discount_policy->all_wards == 1) {
         $discount += $staff_discount / count($same_staff);
         return $discount;
     }
     //dont divide staff discount accross all wards that have thesame staff
     if ($discount_policy->dont_divide == 1) {
         $discount += $staff_discount;
         return $discount;
     }
     if ($discount_policy->all_wards == 0) {
         $student_ids = [];
         foreach ($same_staff as $stud) {
             $student_ids[] = $stud->id;
         }
         sort($student_ids);
         foreach ($student_ids as $key => $student_id) {
             if ($key == $discount_policy->ward_to_deduct - 1) {
                 $ward_to_deduct = $student_id;
             }
         }
         if ($ward_to_deduct == $student->id) {
             $discount += $staff_discount;
         }
         return $discount;
     }
 }
開發者ID:umahatokula,項目名稱:academia,代碼行數:44,代碼來源:Helper.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::find($id);
     $student->delete();
     return redirect('/student');
 }
開發者ID:pyodor,項目名稱:hpo,代碼行數:12,代碼來源:StudentController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::find($id);
     $student->destroy();
     return \Redirect::to('admin/students');
 }
開發者ID:umahatokula,項目名稱:academia,代碼行數:12,代碼來源:studentsController.php

示例15: destroy

 public function destroy($id)
 {
     $data = Student::find($id);
     $data->delete();
     return redirect()->route('student.index');
 }
開發者ID:alandwiprasetyo,項目名稱:laravel-5-2-crud,代碼行數:6,代碼來源:StudentController.php


注:本文中的app\Student::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。