/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $school = School::findOrFail($id); $school->delete(); Session::flash('message', 'Die ausgewählte Schule wurde gelöscht'); return redirect('school'); }
public function show($id) { return School::findOrFail($id); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(SchoolRequest $request, $id) { $school = School::findOrFail($id)->update($request->all()); return redirect('admin/school'); }
public function update() { $id = Input::get('id'); $school = School::findOrFail($id); $name = Input::get('name'); $address = Input::get('address'); $amount_required = Input::get('amount_required'); $description = Input::get('description'); if (Input::file('picture') != null && Input::file('picture')->isValid()) { $destinationPath = 'uploads'; $extension = Input::file('picture')->getClientOriginalExtension(); $fileName = rand(11111, 99999) . '.' . $extension; Input::file('picture')->move($destinationPath, $fileName); $path = $destinationPath . "/" . $fileName; $image = new Image(); $image->path = $path; $image->save(); $school->image_id = $image->image_id; } $school->name = $name; $school->user_id = Auth::user()->user_id; $school->address = $address; $school->amount_required = $amount_required; $school->amount_gathered = $school->amount_gathered; $school->description = $description; $school->save(); return redirect('listings'); }
public function recordstudentEachSectionEachTest($studentId, $newExaminationId) { /* $teachingSections = TeachingSection::where('sections_id', '=', $sectionId)->get(); $studentsIdsIncludingTeachers = DB::table('teaching_sections')->where('sections_id', '=', $sectionId)->lists('users_id'); $students = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIdsIncludingTeachers)->get(); $studentsIds = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIdsIncludingTeachers)->lists('id');*/ // dd($students); // dd($sectionId); // dd($newExaminationId); //generating a transcript table for each student in this examination. $newTranscript = new Transcript(); $newTranscript->examinations_id = $newExaminationId; $newTranscript->users_id = $studentId; $newTranscript->save(); $student = User::findOrFail($studentId); $teachingSection = TeachingSection::getTeachingsectionByStudent($student); $section = Section::findOrFail($teachingSection->sections_id); $school = School::findOrFail($section->schools_id); $studentArray = array(); $studentArray['name'] = $student->name; $studentArray['realname'] = $student->realname; $studentArray['sectionGrade'] = $section->grade; $studentArray['sectionOrder'] = $section->order; $studentArray['schoolName'] = $school->name; // $students = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIds)->paginate(10); // $wholeSectionTranscripts = DB::table('transcripts')->where('examinations_id', '=', $newExaminationId)->whereIn('users_id', $studentsIds)->paginate(10); /* if (Session::has('backUrl')) { Session::keep('backUrl'); }*/ return view('scores.logStudentsTestResult', compact('newTranscript', 'studentArray')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { try { $school = School::findOrFail($id); $school->delete(); } catch (ModelNotFoundException $ex) { Flash::error('No school/club found' . $ex); return redirect()->route('schools.index'); } Flash::success('School/Club deleted successfully'); return back(); }
/** * 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(); }