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


PHP Course::find方法代码示例

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


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

示例1: signToAllStripesForCourse

 public function signToAllStripesForCourse($id)
 {
     $course = Course::find($id);
     foreach ($course->stripes as $stripe) {
         $this->stripes()->attach($stripe);
     }
 }
开发者ID:H3xept,项目名称:SettimanaFlessibile,代码行数:7,代码来源:User.php

示例2: destroy

 public function destroy($id)
 {
     $courses = Course::find($id);
     $courses->schedules()->delete();
     $courses->delete();
     return response()->json(['id' => $id]);
 }
开发者ID:Kangaroos,项目名称:restart-reserve,代码行数:7,代码来源:CourseController.php

示例3: getUnavailableGpAsgs

 public function getUnavailableGpAsgs($courseId)
 {
     $gpAsgs = Course::find($courseId)->gpAsgs;
     return $gpAsgs->filter(function ($gpAsg) {
         return !$this->testGpAsgAvailable($gpAsg);
     });
 }
开发者ID:joseph1125,项目名称:cis,代码行数:7,代码来源:GpAsgsController.php

示例4: getUnavailableWithinGpAsgs

 public function getUnavailableWithinGpAsgs($courseId)
 {
     $withinGpAsgs = Course::find($courseId)->withinGpAsgs;
     return $withinGpAsgs->filter(function ($withinGpAsg) {
         return !$this->testWithinGpAsgAvailable($withinGpAsg);
     });
 }
开发者ID:joseph1125,项目名称:cis,代码行数:7,代码来源:WithinGpAsgsController.php

示例5: show

 public function show($course_id)
 {
     $course = Course::find($course_id);
     if ($course) {
         return $this->createSuccessResponse($course, 200);
     }
     return $this->createErrorResponse("The course with id {$course_id} does not exists", 404);
 }
开发者ID:arielcr,项目名称:lumen-api,代码行数:8,代码来源:CourseController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($course_id)
 {
     if (Auth::user()->isProfessor()) {
         return view('professors.courses.show', ['class' => Course::find($course_id)]);
     } else {
         return view('students.courses.show');
     }
 }
开发者ID:emmendoza1986,项目名称:past_projects,代码行数:14,代码来源:CoursesController.php

示例7: lessons

 public function lessons($domain, $courseId)
 {
     $course = Course::find($courseId);
     if (!$course) {
         return response()->json(['error' => "Môn học không tồn tại"], 404);
     }
     $lessons = Lesson::where('course_id', $courseId)->get();
     return response()->json(['course' => ['id' => $course->id, 'name' => $course->name, 'avatar_url' => $course->icon_url], 'lessons' => $lessons]);
 }
开发者ID:Kaelcao,项目名称:colormev2,代码行数:9,代码来源:MobileController.php

示例8: update

 /**
  * Actualiza un curso por su ID
  * 
  * @param Request
  * @param Int id
  */
 public function update(CourseRequest $request, $id)
 {
     $name = $request->name;
     $url = UrlSanitizer::sanitize($name);
     $request["url"] = $url;
     $curso = Course::find($id);
     $curso->update($request->all());
     return redirect()->route('courses.index');
 }
开发者ID:juanfe190,项目名称:adminclubinnova,代码行数:15,代码来源:CourseController.php

示例9: updateCourse

 public function updateCourse(UpdateCourseRequest $req)
 {
     $course = Course::find($req->id);
     $course->abrr = $req->abrr;
     $course->name = $req->name;
     $course->college = $req->college;
     $course->status = $req->status;
     $course->save();
 }
开发者ID:rozxel21,项目名称:sim,代码行数:9,代码来源:AdminUpdateController.php

示例10: destroy

 public function destroy($id)
 {
     $course = Course::find($id);
     /*     $sections = $grade->sections;
             if ($sections->count() > 0)
                 return back()->with('error', 'No es posible eliminar un curso asociado a secciones.');
     */
     $course->delete();
     return back();
 }
开发者ID:JCarlosR,项目名称:sistema-academico,代码行数:10,代码来源:CourseController.php

示例11: destroy

 public function destroy($teacher_id, $course_id)
 {
     $teacher = Teacher::find($teacher_id);
     if ($teacher) {
         $course = Course::find($course_id);
         if ($course) {
             $course->delete();
             return $this->createSuccessResponse("The course with id {$course->id} has been deleted.", 200);
         }
         return $this->createErrorMessage("The course with the specified id does not exists.", 404);
     }
     return $this->createErrorMessage("The teacher with id {$teacher_id} does not exists.", 404);
 }
开发者ID:Leotrin,项目名称:LearnLumenAPI,代码行数:13,代码来源:TeacherCourseController.php

示例12: update

 public function update($courseId)
 {
     $request = json_decode(request()->getContent());
     $rules = array('name' => 'required', 'attendants' => 'required');
     $validation = Validator::make((array) $request, $rules);
     if ($validation->fails()) {
         return response()->json(array('error' => true, 'message' => $validation->errors()->all(), 200));
     }
     $course = Course::find($courseId);
     $course->name = $request->name;
     $course->attendants = abs($request->attendants);
     $updated = $course->save();
     return response()->json(array('error' => !$updated, 'courses' => $course->toArray()), $updated ? 200 : 500);
 }
开发者ID:ibrohimislam,项目名称:roomate,代码行数:14,代码来源:CoursesController.php

示例13: destroy

 public function destroy($handbook_id, $course_id, $grade_id)
 {
     $course = Course::find($course_id);
     // If the course is already associated
     $relationExist = CourseGrade::where('course_handbook_id', $handbook_id)->where('course_id', $course_id)->where('grade_id', $grade_id)->first();
     if ($relationExist) {
         $relationExist->delete();
         $message = "Se ha eliminado correctamente el curso del grado.";
         $type = "success";
         return back()->with(compact(['message', 'type']));
     }
     $message = "El curso no se encuentra asignado al grado.";
     $type = "warning";
     return back()->with(compact(['message', 'type']));
 }
开发者ID:JCarlosR,项目名称:sistema-academico,代码行数:15,代码来源:CourseGradeController.php

示例14: IN

 function view_curriculum($id)
 {
     $get_cur = DB::select("SELECT `id`,code, descriptivetitle FROM tbl_subject\n                    WHERE tbl_subject.id NOT IN (SELECT subject FROM tbl_curriculumdetail WHERE curriculum = '{$id}')\n                    ORDER BY code ASC,descriptivetitle ASC");
     $cur_detail = DB::table('tbl_curriculumdetail')->where('curriculum', $id)->orderBy('yearlevel', 'ASC')->orderBy('term', 'ASC')->groupBy('yearlevel')->groupBy('term')->get();
     $cur = DB::table('tbl_curriculum')->where('id', $id)->first();
     $cm = DB::table('tbl_coursemajor')->where('id', $cur->coursemajor)->first();
     $c = Course::find($cm->course);
     $m = '';
     if ($cm->major != 0) {
         $m = DB::table('tbl_major')->where('id', $cm->major)->first();
         $major = $m->description;
     }
     $course = $c->description . ' ' . $m;
     return view('dean.view_curriculum', compact('get_cur', 'cur_detail', 'cur', 'id', 'course'));
 }
开发者ID:Jheysoon,项目名称:lcis-2,代码行数:15,代码来源:Curriculum.php

示例15: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $course = Course::find($this->courses);
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['department_id' => 'integer|min:1', 'code' => 'required|unique:courses|max:20', 'name' => 'required|max:254'];
         case 'PUT':
         case 'PATCH':
             return ['department_id' => 'integer|min:1', 'code' => "required|unique:courses,code,{$course->id}|max:20", 'name' => 'required|max:254'];
         default:
             break;
     }
 }
开发者ID:zheralfin,项目名称:oras,代码行数:21,代码来源:CourseRequest.php


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