当前位置: 首页>>代码示例>>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;未经允许,请勿转载。