当前位置: 首页>>代码示例>>PHP>>正文


PHP Course::findOrFail方法代码示例

本文整理汇总了PHP中app\Course::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::findOrFail方法的具体用法?PHP Course::findOrFail怎么用?PHP Course::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Course的用法示例。


在下文中一共展示了Course::findOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $course = Course::findOrFail($id);
     $course->delete();
     Session::flash('message', 'Successfully Deleted your Data!');
     return redirect()->back();
 }
开发者ID:minhajCSE,项目名称:teleaus-dev,代码行数:13,代码来源:TrainingController.php

示例2: destroy

 public function destroy($id)
 {
     $course = Course::findOrFail($id);
     $course->delete();
     session()->flash('success', 'El curso ' . $course->name . ' se ha eliminado.');
     return redirect()->route('admin.course.index');
 }
开发者ID:abalozz,项目名称:glaciar,代码行数:7,代码来源:CoursesController.php

示例3: training

 /**
  * Show training page for registration
  *
  * @param $id
  *
  * @return $this
  */
 public function training($id)
 {
     if (isset($id)) {
         $course = Course::findOrFail($id);
     }
     $data = ['title' => 'Teleaus | Training Page', 'parentPage' => 'Recources', 'page' => 'Registration form ', 'course' => count($course) ? $course : 0];
     return view('training-form')->with($data);
 }
开发者ID:minhajCSE,项目名称:teleaus-dev,代码行数:15,代码来源:TrainingController.php

示例4: store

 public function store(ContentRequest $request)
 {
     $course = Course::findOrFail($request->input('course_id'));
     $this->authorize('manage-course-contents', $course);
     $content = new Content($request->only(['title', 'body']));
     $content->course()->associate($course);
     $content->save();
     session()->flash('success', 'El contenido se ha publicado.');
     return redirect()->route('content.edit', $content->id);
 }
开发者ID:abalozz,项目名称:glaciar,代码行数:10,代码来源:ContentsController.php

示例5: store

 public function store(QuestionRequest $request)
 {
     $course = Course::findOrFail($request->input('course_id'));
     $this->authorize('view-course', $course);
     $question = new Question($request->only(['title', 'body']));
     $question->course()->associate($course);
     $question->user()->associate(auth()->user());
     $question->save();
     session()->flash('success', 'La pregunta ha sido enviada');
     return redirect()->back();
 }
开发者ID:abalozz,项目名称:glaciar,代码行数:11,代码来源:QuestionsController.php

示例6: addToCart

 public function addToCart(Request $request)
 {
     $orders = $request->session()->get('orders');
     if (isset($orders)) {
         foreach ($orders as $course) {
             if ($course->id == $request->course_id) {
                 return redirect()->back();
             }
         }
     }
     $course = Course::findOrFail($request->course_id);
     $request->session()->push('orders', $course);
     $request->session()->put('total', $this->totalPrice($request->session()->get('orders')));
     return redirect()->back();
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:15,代码来源:OrdersController.php

示例7: sendMail

 public function sendMail($id)
 {
     $file = Data::findOrFail($id);
     $pathToFile = $file->path;
     Mail::raw(Input::get('body'), function ($message) use($pathToFile, $file) {
         $message->to(Input::get('email'));
         $message->subject(Input::get('subject'));
         $message->attach($pathToFile, ['as' => $file->name, 'mime' => 'application/pdf']);
     });
     if ($file->courseId != null) {
         $course = Course::findOrFail($file->courseId);
         return Redirect::action('CoursesController@showParam', [$course->slug]);
     }
     if ($file->snippetId != null) {
         $snippet = Snippet::findOrFail($file->snippetId);
         return Redirect::action('CoursesController@show', [$snippet->slug]);
     }
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:18,代码来源:MailingController.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $course = Course::findOrFail($id);
     $questions = Question::where('course_id', '=', $course->id)->get();
     return view('que.show', compact('course', 'questions'));
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:12,代码来源:QuestionController.php

示例9: toggleLike

 public function toggleLike($id)
 {
     $course = Course::findOrFail($id);
     $course->toggleLike();
     return Redirect::action('CoursesController@show', [$course->slug]);
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:6,代码来源:CoursesController.php

示例10: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $course = Course::findOrFail($id);
     if (\Auth::user()->role_id == 3) {
         $professor = DB::table('professors')->join('users', 'professors.user_id', '=', 'users.id')->where('users.id', '=', \Auth::user()->id)->first();
         return view('professor.edit_course', compact('course', 'professor'));
     }
 }
开发者ID:jasmirabueno,项目名称:phileduc,代码行数:14,代码来源:CourseController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  * @internal param ShowLessonRequest $request
  */
 public function show($id)
 {
     $course = Course::findOrFail($id);
     return view('courses.show')->with('course', $course)->with('title', $course->title);
 }
开发者ID:jrafaelca,项目名称:school_virtual,代码行数:12,代码来源:CoursesController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $course = Course::findOrFail($id);
     $course->delete();
     return redirect()->route('courses.index')->with('message', 'Item deleted successfully.');
 }
开发者ID:edmiranda,项目名称:uai_courses,代码行数:12,代码来源:CourseController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $course = Course::findOrFail($id);
     $course->delete();
     Session::flash('flash_message', 'Námskeiðinu hefur verið eytt');
     return redirect()->route('dashboard.courses.index');
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:13,代码来源:CoursesController.php

示例14: getDaysForCourse

 /**
  * Get the Days for A Course
  * @param  int $id 
  * @return App\Day
  */
 public function getDaysForCourse($id)
 {
     $course = Course::findOrFail($id);
     return $course->days;
 }
开发者ID:octopoda,项目名称:FLDS,代码行数:10,代码来源:CourseController.php

示例15: getExamEdit

 public function getExamEdit($id)
 {
     $course = Course::findOrFail($id);
     $questions = $course->test()->first()->questions()->get();
     return view('courses.test_edit', compact('questions'));
 }
开发者ID:DarkBlackJPG,项目名称:Learn_ON-1,代码行数:6,代码来源:CoursesController.php


注:本文中的app\Course::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。