本文整理汇总了PHP中app\Course::whereId方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::whereId方法的具体用法?PHP Course::whereId怎么用?PHP Course::whereId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Course
的用法示例。
在下文中一共展示了Course::whereId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
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'));
}
示例2: destroy
/**
* 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!');
}
示例3: preform_fill
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);
}
示例4: course_name_by_course_id
/**
* 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();
}