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


PHP Course::with方法代码示例

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


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

示例1: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     \View::composer('*', function ($view) {
         $allCourses = \App\Course::with('requirements')->orderBy('course_name', 'ASC')->get()->toArray();
         $view->with('user', \Auth::user())->with('allCourses', $allCourses);
     });
 }
开发者ID:dnvmbr,项目名称:p4,代码行数:12,代码来源:ComposerServiceProvider.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($semester = null, $year = null)
 {
     $user = Auth::user();
     $split = explode(" ", $user->role->name);
     $role_area = $split[count($split) - 1];
     $areas = Area::with('professors')->get()->toArray();
     $profe = Professor::with('areas')->get()->toArray();
     $prof_areas = array();
     foreach ($profe as $prof) {
         $prof_areas[$prof['id']] = $prof['areas'];
     }
     $collection = collect($areas);
     $area_professors = $collection->keyBy('name')->toArray();
     // TODO: Pasar esto a un Helper
     if ($semester == null) {
         \Carbon\Carbon::now()->month >= 5 ? $semester = 2 : ($semester = 1);
     }
     $year == null ? $year = \Carbon\Carbon::now()->year : ($year = $year);
     $courses = Course::with('area')->get()->toArray();
     if ($role_area == "Administrador") {
         $professors = Professor::all()->toArray();
         //TODO: Pasar esto a un scope
         $unasigned_courses = Course::with('area')->where('taken', 0)->where('semester', $semester)->where('year', $year)->get();
         $asigned_courses = Course::with('area')->where('taken', 1)->where('semester', $semester)->where('year', $year)->get();
     } else {
         $professors = Area::with('professors')->where('name', $role_area)->get()->toArray()[0]["professors"];
         $area = Area::where('name', $role_area)->first();
         $unasigned_courses = Course::where('taken', 0)->where('area_id', $area->id)->where('semester', $semester)->where('year', $year)->get();
         $asigned_courses = Course::where('taken', 1)->where('area_id', $area->id)->where('semester', $semester)->where('year', $year)->get();
     }
     $professorCourse = array();
     foreach ($courses as $course) {
         if (Schedule::where('course_id', $course['id'])->first() != null) {
             $professorId = Schedule::where('course_id', $course['id'])->first()->professor_id;
             $professorCourse[$course['id']] = Professor::where('id', $professorId)->first()->name;
         }
     }
     return view('schedules.index', compact('area_professors', 'prof_areas', 'professors', 'courses', 'professorCourse', 'unasigned_courses', 'asigned_courses', 'year', 'semester'));
 }
开发者ID:edmiranda,项目名称:uai_courses,代码行数:44,代码来源:ScheduleController.php

示例3: getCourse

 public function getCourse()
 {
     $course = Course::with('course_id', $this->course_id);
     return $course;
 }
开发者ID:bigschlong69,项目名称:capstoneAll,代码行数:5,代码来源:Roster.php

示例4: getAllCourses

 public function getAllCourses()
 {
     return Course::with('holes.tees', 'teeSets.teeType', 'teeSets.tees')->get();
 }
开发者ID:robeasdon,项目名称:golf-stat-tracker,代码行数:4,代码来源:CourseRepository.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $course = Course::with('tests', 'tests.questions')->has('tests.questions', '>', 0)->published()->findOrFail($id);
     return view('course.show', ['course' => $course]);
 }
开发者ID:Orvo,项目名称:mlraamattu,代码行数:11,代码来源:CoursesController.php

示例6: getRecord

 public function getRecord($id)
 {
     return Course::with('college')->find($id);
 }
开发者ID:humbleBeginner,项目名称:unp_guidanceRMS,代码行数:4,代码来源:CourseController.php

示例7: getCourses

 public function getCourses()
 {
     $courses = Course::with('college')->get();
     return view('admin.coursesList', compact('courses'));
 }
开发者ID:humbleBeginner,项目名称:unp_guidanceRMS,代码行数:5,代码来源:AdminPageController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $courses = Course::with('area')->get();
     return view('courses.index', compact('courses'));
 }
开发者ID:edmiranda,项目名称:uai_courses,代码行数:10,代码来源:CourseController.php

示例9: documentsValidated

 public function documentsValidated($id, $value)
 {
     $course = Course::with(['users' => function ($query) {
         $query->where('level', 1);
     }, 'manager'])->find($id);
     if (empty($course)) {
         Flash::error('Ce cours n\'existe pas.');
         return abort(404);
     }
     if (Auth::user()->level_id <= 3 && !$course->users->contains(Auth::user())) {
         Flash::error('Vous n\'avez pas les droits suffisants.');
         return Redirect::back();
     }
     if ($value != 0 && $value != 1) {
         Flash::error('Requête invalide.');
         return Redirect::back();
     }
     $documents = Document::where('course_id', $id)->where('validated', $value)->with('author')->paginate(15);
     $filter = $value == 0 ? 'invalidés' : 'validés';
     return view('admin.courses.documents', compact('documents', 'filter', 'course'));
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:21,代码来源:CourseController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $course = Course::with('tests', 'tests.questions', 'tests.questions.answers')->findOrFail($id);
     foreach ($course->tests as $test) {
         foreach ($test->questions as $question) {
             foreach ($question->answers as $answer) {
                 $answer->delete();
             }
             $question->delete();
         }
         $test->delete();
     }
     $course->delete();
 }
开发者ID:Orvo,项目名称:mlraamattu,代码行数:20,代码来源:CoursesController.php


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