本文整理汇总了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]);
}
示例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');
}
示例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]);
}
示例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');
}
示例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'));
}
示例6: findStudent
public function findStudent(Route $route)
{
$this->student = Student::findOrFail($route->getParameter('student'));
}
示例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');
}
示例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'));
}
示例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);
}
示例10: loggedIn
public static function loggedIn()
{
$id = Session::get('student_id');
$student = Student::findOrFail($id);
return $student;
}
示例11: update
public function update($id, RegisterStudent $request)
{
$student = Student::findOrFail($id);
$student->update($request->all());
}
示例12: store
public function store($student_id, makeTransaction $request)
{
$student = Student::findOrFail($student_id);
$student->fees()->save($request->all());
}
示例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>');
}
示例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();
}
示例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';
}