當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Course::all方法代碼示例

本文整理匯總了PHP中app\Course::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::all方法的具體用法?PHP Course::all怎麽用?PHP Course::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Course的用法示例。


在下文中一共展示了Course::all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: main

 public function main(Request $request)
 {
     switch ($request->data) {
         case "courses":
             $courses = Course::all();
             foreach ($courses as $course) {
                 $course["status"] = $course->seatsStatus();
                 $course["enrolled"] = $course->totalEnrolled();
                 $course["waitlist"] = $course->totalWaitlisted();
             }
             return response()->json(['courses' => $courses]);
         case "gpa":
             if ($request->has('student_id')) {
                 $student = User::find($request->get('student_id'));
                 return $student->gpa();
             } else {
                 return [];
             }
         case "classestaken":
             return Auth::user()->pastClasses();
         case "activecodes":
             $section_id = $request->get('section_id');
             return Auth::user()->returnActiveCodes($section_id);
         case "generateaddcode":
             $section_id = $request->get('section_id');
             Auth::user()->generateAddCode($section_id);
             return redirect()->action('CoursesController@addCode');
         default:
             return "no data specified";
     }
 }
開發者ID:emmendoza1986,項目名稱:past_projects,代碼行數:31,代碼來源:APIController.php

示例2: new_student

 public function new_student()
 {
     $data['courses'] = Course::all();
     $data['majors'] = DB::table('tbl_major')->get();
     $data['religions'] = DB::table('tbl_religion')->get();
     return view(Api::getView(), $data);
 }
開發者ID:Jheysoon,項目名稱:lcis-2,代碼行數:7,代碼來源:Registration.php

示例3: preform_fill

 public function preform_fill()
 {
     $courses = Course::all();
     // $attendances = Attendance::all();
     //$infos = Info::all();
     return view('attendances.preform_fill', compact('courses', 'infos'))->with('trainings', 'active');
 }
開發者ID:sanjidarafin,項目名稱:tms_bard-laravel-,代碼行數:7,代碼來源:AttendanceController.php

示例4: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $courses = Course::all();
     $user = Auth::User();
     $user_id = $user->id;
     return view('trainee.create', compact('courses'))->with('user_id', $user_id);
 }
開發者ID:NabanitaBiswas,項目名稱:Training_management_BARD,代碼行數:12,代碼來源:InfosController.php

示例5: index

 public function index()
 {
     $courses = Centre::with('courses')->get();
     $papers = Paper::with('courses')->get();
     $levels = Level::with('levels')->get();
     $courseNum = Course::all();
     return view('acca.base')->withCentres($courses)->withPapers($papers)->withLevels($levels)->with('courseNum', $courseNum);
 }
開發者ID:KaplanDigitalMarketing,項目名稱:Timetables,代碼行數:8,代碼來源:AccaController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     if (Auth::user()->id <= 38) {
         return view('professors.courses.index', ['courses' => Course::all()]);
     } else {
         return view('students.courses.index', ['courses' => Course::all()]);
     }
 }
開發者ID:emmendoza1986,項目名稱:past_projects,代碼行數:13,代碼來源:CoursesController.php

示例7:

 function __construct()
 {
     $this->pageTitle = 'Courses';
     $this->pageModel = 'course';
     $this->pageSlug = $this->seoUrl($this->pageTitle);
     $this->courses = Course::all();
     $this->middleware('auth');
 }
開發者ID:purplenimbus,項目名稱:Nimbus-SMS,代碼行數:8,代碼來源:CourseController.php

示例8: index

 public function index($survey_id = null)
 {
     $this->data['surveys'] = Survey::all();
     $gens = Gen::all();
     $this->data['gens'] = $gens;
     $this->data['courses'] = Course::all();
     $this->data['current_gen'] = Gen::getCurrentGen();
     return view('manage.survey', $this->data);
 }
開發者ID:Kaelcao,項目名稱:colormev2,代碼行數:9,代碼來源:SurveyController.php

示例9: admin

 public function admin()
 {
     if ($user = Sentinel::check()) {
         $courses = Course::all();
         return view('courses.list', compact('courses'));
     } else {
         return redirect('/');
     }
 }
開發者ID:alexchirea,項目名稱:Site-Coupons,代碼行數:9,代碼來源:CoursesController.php

示例10: numberOfViewsPerCourse

 public function numberOfViewsPerCourse()
 {
     $courses = Course::all();
     $viewsByCourse = [];
     foreach ($courses as $course) {
         $viewsByCourse[$course->name] = [$this->getCountOfCourseRoute($course)];
     }
     return $viewsByCourse;
 }
開發者ID:starkbaum,項目名稱:sucon,代碼行數:9,代碼來源:StatisticsController.php

示例11: getIndex

 public function getIndex()
 {
     if (Request::ajax()) {
         $colleges = College::all();
         $courses = Course::all();
         $scholarships = Scholarship::all();
         $students = Student::where('archived', 0)->get();
         return compact('colleges', 'courses', 'scholarships', 'students');
     }
 }
開發者ID:humbleBeginner,項目名稱:unp_guidanceRMS,代碼行數:10,代碼來源:AjaxSourceController.php

示例12: index

 public function index()
 {
     if (auth()->user()->can('admin')) {
         $courses = Course::all();
     } else {
         $courses = auth()->user()->courses()->get();
     }
     $coursesThatTeach = auth()->user()->coursesThatTeach()->get();
     return view('courses.index', compact('courses', 'coursesThatTeach'));
 }
開發者ID:abalozz,項目名稱:glaciar,代碼行數:10,代碼來源:CoursesController.php

示例13: admin

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function admin()
 {
     $data = Request::all();
     $college = College::all();
     foreach ($college as $colleges) {
         $scollege[] = $colleges->scollege;
     }
     $course = Course::all();
     // return view('pages.administrator')->with('school',$school);
     return view('pages.administrator', compact('college'), compact('course'))->with('scollege', $scollege);
 }
開發者ID:jMelgar101,項目名稱:Classnotch,代碼行數:16,代碼來源:NoteBookController.php

示例14: index

 public function index($handbook_id, $grade_id)
 {
     $handbook = CourseHandbook::find($handbook_id);
     // Get all courses and grades to fill the selects
     $courses = Course::all();
     $grades = Grade::all();
     // Select the grade and its courses associated in the current handbook
     $current_grade = Grade::find($grade_id);
     $current_courses = CourseGrade::where('course_handbook_id', $handbook_id)->where('grade_id', $grade_id)->get(['course_id']);
     $current_courses = $this->convertToCourseCollection($current_courses);
     return view('configuracion.asignar-cursos')->with(compact(['handbook', 'courses', 'grades', 'current_courses', 'current_grade']));
 }
開發者ID:JCarlosR,項目名稱:sistema-academico,代碼行數:12,代碼來源:CourseGradeController.php

示例15: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $courses = Course::all();
     $user_id = Auth::User()->id;
     $trainee_info = Info::whereTrainee_login_id($user_id)->get();
     if ($trainee_info->isEmpty()) {
         $user_name = $this->trainee_name_by_user_id($user_id);
         return view('trainee.create')->with('user_id', $user_id)->with('courses', $courses)->with('user_name', $user_name);
     } else {
         $trainee_info = Info::whereTrainee_login_id($user_id)->firstOrFail();
         return redirect('trainee_profile/' . $trainee_info->id . '/edit_profile');
     }
 }
開發者ID:polycste,項目名稱:training_management,代碼行數:18,代碼來源:InfosController.php


注:本文中的app\Course::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。