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


PHP Course::with方法代码示例

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


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

示例1: create

 public function create($course_id)
 {
     $course = Course::with('placements')->find($course_id);
     $subjects = Subject::all();
     $menu = 'academic';
     return View::make('masteries.create', compact('course', 'subjects', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:7,代码来源:MasteriesController.php

示例2: create

 public function create($course_id)
 {
     $course = Course::with('placements')->find($course_id);
     $employees = Employee::where('teach_salary', '>', 0.0)->get();
     $hours = Hour::all();
     $menu = 'academic';
     return View::make('presences.create', compact('course', 'subjects', 'employees', 'hours', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:8,代码来源:PresencesController.php

示例3: destroy

 public function destroy($id)
 {
     $course = Course::with('placements')->find($id);
     if ($course->placements->count() > 0) {
         Session::flash('message', 'Tidak dapat menghapus data Kelas! Kelas ini pernah digunakan!');
     } else {
         Course::destroy($id);
         Session::flash('message', 'Sukses menghapus data Kelas!');
     }
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:10,代码来源:CoursesController.php

示例4: exporttCourseAttendenceToCSV

 /**
  * Exports the total amount of students that are taking each course to a CSV file
  */
 public function exporttCourseAttendenceToCSV()
 {
     $course_data = Course::with('students')->get();
     $csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
     $column_flag = false;
     $course_listing = [];
     foreach ($course_data as $course) {
         $course_listing['course_name'] = $course->course_name;
         $course_listing['num_students'] = count($course->students);
         //Check whether column headers have been set (not ideal for large datasets)
         if ($column_flag === false) {
             $csv->insertOne(\Schema::getColumnListing('course_listing'));
             $column_flag = true;
         }
         $csv->insertOne($course_listing);
     }
     $csv->output('course_attendance_records.csv');
 }
开发者ID:ZeroGodForce,项目名称:RMP_Challenge_Me,代码行数:21,代码来源:ExportController.php

示例5: recapCourse

 public function recapCourse()
 {
     $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->get();
     $periods = DB::table('registrations')->select(DB::raw('month(registration_date) as months'), DB::raw('year(registration_date) as years'))->groupBy(DB::raw('month(registration_date)'))->get();
     $courselists = array();
     foreach ($courses as $course) {
         $statistics = array();
         foreach ($periods as $period) {
             $count = Course::with(array('placements', 'placements.issues.registration'))->join('placements', 'placements.course_id', '=', 'courses.id')->join('issues', 'issues.id', '=', 'placements.issue_id')->join('registrations', 'registrations.id', '=', 'issues.registration_id')->where(DB::raw('month(registrations.registration_date)'), '=', $period->months)->where(DB::raw('year(registrations.registration_date)'), '=', $period->years)->where('courses.id', '=', $course->id)->count();
             $statistics[] = array('count' => $count);
         }
         $courselists[] = array('id' => $course->id, 'name' => $course->name, 'statistics' => $statistics);
     }
     $menu = 'report';
     return View::make('reports.recapcourse', compact('periods', 'courselists', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:16,代码来源:ReportsController.php


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