public function show($id) { $courses = Course::whereId($id)->firstOrFail(); $training_id = $courses->training_id; $training_name = $this->training_name_by_training_id($training_id); return view('course.show_public', compact('courses', 'training_name')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $courses = Course::whereId($id)->firstOrFail(); $courses->delete(); return redirect('/courses')->with('The ticket ' . $id . ' has been deleted!'); }
public function preform_fill() { $user_id = Auth::user()->id; $courses = Trainercourse::wheretrainer_id($user_id)->get(); $all_course = []; foreach ($courses as $course) { $all_course[] = Course::whereId($course->course_id)->firstOrFail(); } return view('attendances.preform_fill')->with('courses', $all_course); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function course_name_by_course_id($id) { return Course::whereId($id)->select('course_name')->get(); }