当前位置: 首页>>代码示例>>PHP>>正文


PHP Student::findOrFail方法代码示例

本文整理汇总了PHP中app\Student::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::findOrFail方法的具体用法?PHP Student::findOrFail怎么用?PHP Student::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Student的用法示例。


在下文中一共展示了Student::findOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editName

 public function editName(Request $request)
 {
     $id = $request->input('id');
     $fullname = $request->input('fullname');
     $this->student->findOrFail($id)->update(['fullname' => $fullname]);
     return response()->json(['status' => 1, 'fullname' => $fullname]);
 }
开发者ID:saphira145,项目名称:laravelApp,代码行数:7,代码来源:StudentsController.php

示例2: up

 public function up($id)
 {
     $dateNow = time();
     $student = Student::findOrFail($id);
     $student->update(['status' => 1, 'registered_at' => $dateNow]);
     session()->flash('flash_message', 'Anda telah melakukan perpanjangan masa aktif siswa!');
     return redirect()->route('settings.student');
 }
开发者ID:arooth,项目名称:Library-Management-System,代码行数:8,代码来源:StudentController.php

示例3: 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)
 {
     $this->validate($request, ['contact11' => 'integer|min:1000000000|max:9999999999', 'contact12' => 'integer|max:9999999999', 'std_pincode' => 'integer']);
     $studentData = Student::findOrFail($id);
     $studentAdds = $studentData->addresses->flatten()->toArray();
     foreach ($studentAdds as $key => $value) {
         $studentAdd = $value;
     }
     $addressData = Address::findOrFail($studentAdd['id']);
     $addressData->update(['contact11' => $request->contact11, 'contact12' => $request->contact12, 'add1' => ucwords($request->add1), 'add2' => ucwords($request->add2), 'street' => ucwords($request->street), 'pincode' => $request->pincode]);
     return Redirect::route('student.show', ['student' => $addressData]);
 }
开发者ID:Khande1n,项目名称:ujval,代码行数:19,代码来源:AddressController.php

示例4: pengembalian

 public function pengembalian($id)
 {
     $returnedAt = time();
     $transaction = Transaction::findOrFail($id);
     $transaction->update(['status' => 1, 'returned_at' => $returnedAt]);
     //ini bisa langsung, cuman kan harus ambil data stock nya dulu mzzz
     //$transaction->book()->update(['stock' => 7]);
     $book = Book::findOrFail($transaction['book_id']);
     $stock = $book['stock'] + 1;
     $book->update(['stock' => $stock]);
     $student = Student::findOrFail($transaction['student_id']);
     $borrow = $student['borrow'] - 1;
     $student->update(['borrow' => $borrow]);
     session()->flash('flash_message', 'You have been doing 1 returned transaction!');
     return redirect()->route('peminjaman.histori');
 }
开发者ID:arooth,项目名称:Library-Management-System,代码行数:16,代码来源:PeminjamanController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->authorize('create', new Inscription());
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     $schoolyear = Schoolyear::orderBy('id', 'DESC')->first();
     $request['school_id'] = Auth::user()->school_id;
     $request['schoolyear_id'] = $schoolyear->id;
     //student first
     $student = null;
     if (!isset($request['student_id']) || $request['student_id'] == 0) {
         $student = Student::create($request->all());
     } else {
         $student = Student::findOrFail($request['student_id']);
         $student->update($request->all());
     }
     $request['student_id'] = $student->id;
     $inscription = Inscription::create($request->all());
     //agregar al grupo
     $inscription->group->students->push($student);
     //return redirect('inscription');
     return view('inscription.step2', compact('inscription'));
 }
开发者ID:afelipelc,项目名称:Bachilleratos-Digitales-Laravel,代码行数:27,代码来源:InscriptionController.php

示例6: findStudent

 public function findStudent(Route $route)
 {
     $this->student = Student::findOrFail($route->getParameter('student'));
 }
开发者ID:JJHdez,项目名称:OpenTpmW,代码行数:4,代码来源:StudentsController.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Student  $student
  * @return Response
  */
 public function update(Student $student, Request $request)
 {
     $this->authorize('update', $student);
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     $student = Student::findOrFail($id);
     $student->update($request->all());
     return redirect('student');
 }
开发者ID:afelipelc,项目名称:Bachilleratos-Digitales-Laravel,代码行数:14,代码来源:StudentController.php

示例8: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $student = Student::findOrFail($id);
     return view('principal.edit', compact('student'));
 }
开发者ID:Khande1n,项目名称:ujval,代码行数:11,代码来源:DashboardController.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request)
 {
     Student::findOrFail($request->input('id'))->delete();
     return response('Deleted professor.', 200);
 }
开发者ID:BootySYS,项目名称:bootysys,代码行数:11,代码来源:StudentsController.php

示例10: loggedIn

 public static function loggedIn()
 {
     $id = Session::get('student_id');
     $student = Student::findOrFail($id);
     return $student;
 }
开发者ID:roee97,项目名称:rabinew,代码行数:6,代码来源:Student.php

示例11: update

 public function update($id, RegisterStudent $request)
 {
     $student = Student::findOrFail($id);
     $student->update($request->all());
 }
开发者ID:ducaale,项目名称:university-management-app,代码行数:5,代码来源:studentController.php

示例12: store

 public function store($student_id, makeTransaction $request)
 {
     $student = Student::findOrFail($student_id);
     $student->fees()->save($request->all());
 }
开发者ID:ducaale,项目名称:university-management-app,代码行数:5,代码来源:studentFeeController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::findOrFail($id);
     $student->delete();
     return redirect()->action('StudentController@index')->with('message', '<div class="alert alert-info">Student deleted successfully</div>');
 }
开发者ID:paulbokel,项目名称:mentoring,代码行数:12,代码来源:StudentController.php

示例14: mail_invoice

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function mail_invoice($student_id, $fee_schedule_code)
 {
     $table = 'fee_sch_' . session()->get('current_session') . '_' . session()->get('current_term');
     $data['fee_elements'] = DB::table($table)->where('fee_schedule_code', $fee_schedule_code)->get();
     $data['fee_schedule'] = DB::table($table)->where('fee_schedule_code', $fee_schedule_code)->first();
     $data['invoice'] = \DB::table('invoices_' . \Session::get('current_session') . '_' . \Session::get('current_term'))->where(['student_id' => $student_id, 'fee_schedule_code' => $fee_schedule_code])->first();
     // dd($data['fee_schedule']);
     $student = Student::findOrFail($student_id);
     $data['student'] = $student;
     $data['school'] = School::findOrFail(1);
     //get this students parent
     $data['parent_email'] = $data['student']->studentParent->email;
     $send_mail = Helper::sendStudentInvoice($data, $student);
     // dd($send_mail);
     return redirect()->back();
 }
开发者ID:umahatokula,项目名称:academia,代码行数:22,代码来源:invoicesController.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $student = Student::findOrFail($id);
     $student->delete();
     return 'Student usuni�ty';
 }
开发者ID:nepras,项目名称:laravel5_kurs,代码行数:12,代码来源:StudentController.php


注:本文中的app\Student::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。