當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。