本文整理汇总了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";
}
}
示例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);
}
示例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');
}
示例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);
}
示例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);
}
示例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()]);
}
}
示例7:
function __construct()
{
$this->pageTitle = 'Courses';
$this->pageModel = 'course';
$this->pageSlug = $this->seoUrl($this->pageTitle);
$this->courses = Course::all();
$this->middleware('auth');
}
示例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);
}
示例9: admin
public function admin()
{
if ($user = Sentinel::check()) {
$courses = Course::all();
return view('courses.list', compact('courses'));
} else {
return redirect('/');
}
}
示例10: numberOfViewsPerCourse
public function numberOfViewsPerCourse()
{
$courses = Course::all();
$viewsByCourse = [];
foreach ($courses as $course) {
$viewsByCourse[$course->name] = [$this->getCountOfCourseRoute($course)];
}
return $viewsByCourse;
}
示例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');
}
}
示例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'));
}
示例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);
}
示例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']));
}
示例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');
}
}