本文整理汇总了PHP中Course::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::where方法的具体用法?PHP Course::where怎么用?PHP Course::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($id)
{
$student = Issue::with('placements', 'placement', 'receivable.installments', 'educations', 'education', 'earnings', 'punishments', 'returnments', 'presences', 'points', 'retrievals', 'timelines', 'masteries')->find($id);
$periods = Teach::with(array('presences' => function ($q) use($id) {
$q->where('issue_id', '=', $id);
}))->select(DB::raw('month(course_date) as months'), DB::raw('year(course_date) as years'))->groupBy(DB::raw('month(course_date)'))->get();
$presences = array();
foreach ($periods as $period) {
$presences[] = array('month' => $period->months, 'year' => $period->years, 'presences' => $this->countPresences($id, $period->months, $period->years), 'presents' => $this->countPresents($id, $period->months, $period->years), 'absents' => $this->countAbsents($id, $period->months, $period->years), 'sicks' => $this->countSicks($id, $period->months, $period->years), 'permits' => $this->countPermits($id, $period->months, $period->years));
}
$points = array();
foreach ($student->points as $point) {
if ($point->pointable_type == 'Activity') {
$points[] = array('date' => $point->pointable->agenda, 'event' => $point->pointable->name, 'point' => $point->point, 'lowest' => $this->getLowest($point->pointable_id), 'highest' => $this->getHighest($point->pointable_id));
}
}
$handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $student->generation_id)->get();
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$discounts = Discount::all();
$promotions = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get();
$vouchers = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get();
$charges = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get();
$menu = 'student';
return View::make('students.show', compact('student', 'handbooks', 'courses', 'discounts', 'promotions', 'vouchers', 'charges', 'presences', 'points', 'menu'));
}
示例2: index
public function index()
{
$quizzes = Quiz::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'academic';
return View::make('quizzes.index', compact('quizzes', 'courses', 'menu'));
}
示例3: edit
public function edit($id)
{
$movement = Movement::findOrFail($id);
$courses = Course::where('location_id', '=', Auth::user()->location_id)->get();
$employees = Employee::all();
$menu = 'student';
return View::make('movements.edit', compact('movement', 'courses', 'employees', 'menu'));
}
示例4: create
public function create()
{
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$classifications = Classification::where('category', '=', 'Resign')->get();
$menu = 'student';
return View::make('resigns.create', compact('courses', 'classifications', 'employees', 'menu'));
}
示例5: filter
public function filter($date)
{
$curr_date = $date;
$teaches = Teach::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('course_date', '=', $curr_date)->get();
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'academic';
return View::make('presences.index', compact('teaches', 'courses', 'curr_date', 'menu'));
}
示例6: show
public function show($id)
{
$activity = Activity::find($id);
$participations = Participation::with('issue', 'employee')->where('activity_id', '=', $id)->get();
$menu = 'academic';
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
return View::make('participations.show', compact('activity', 'participations', 'courses', 'menu'));
}
示例7: getLastIdCourse
public function getLastIdCourse($id_course)
{
$id_course = (int) ($id_course / 1000000) * 1000000;
$course = Course::where('id', '>', $id_course)->where('id', '<', $id_course + 100)->orderBy('id', 'desc')->first();
if (is_null($course)) {
return $id_course;
} else {
return $course->id;
}
}
示例8: create
public function create()
{
$menu = 'registration';
$generations = Generation::all();
$classifications = Classification::where('category', '=', 'Registration')->get();
$locations = Location::where('id', '<>', Auth::user()->location_id)->get();
$employees = Employee::all();
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->where('active', '=', 1)->get();
$discounts = Discount::all();
$promotions = Promotion::all();
$vouchers = Voucher::all();
$charges = Charge::all();
$partners = Partner::where('location_id', '=', Auth::user()->location_id)->get();
return View::make('registrations.create', compact('classifications', 'locations', 'employees', 'generations', 'courses', 'charges', 'discounts', 'promotions', 'vouchers', 'partners', 'menu'));
}
示例9: index
public function index()
{
$subjects = Subject::all();
$menu = 'academic';
$statistics = array();
foreach ($subjects as $subject) {
$total_a = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'A')->groupBy('issue_id')->count();
$total_b = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'B')->groupBy('issue_id')->count();
$total_c = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'C')->groupBy('issue_id')->count();
$total_d = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'D')->groupBy('issue_id')->count();
$total_e = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'E')->groupBy('issue_id')->count();
$statistics[] = array('id' => $subject->id, 'name' => $subject->name, 'a' => $total_a, 'b' => $total_b, 'c' => $total_c, 'd' => $total_d, 'e' => $total_e);
}
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
return View::make('masteries.index', compact('statistics', 'courses', 'menu'));
}
示例10: products
public function products($courseId)
{
if (isset($courseId)) {
$products = Product::where('status', '=', 'active')->where('course_id', $courseId)->get();
if (isset($products)) {
$cart = Session::get('cart');
if ($cart) {
foreach ($products as $product) {
$product->added = 'n';
foreach ($cart as $cartItem) {
if ($cartItem['productId'] == $product->id) {
$product->added = 'y';
break;
}
}
}
} else {
$arProducts = array();
foreach ($products as $product) {
$product->added = 'n';
}
}
$course = Course::where('id', $courseId)->with('institute')->first();
if (isset($course)) {
$subjects = Product::where('course_id', $courseId)->select('subject')->groupBy('subject')->get();
if (isset($subjects) && count($subjects) > 0) {
return View::make('product.list')->with('found', true)->with('products', $products)->with('subjects', $subjects->toArray())->with('course', $course);
} else {
return View::make('product.list')->with('found', false)->with('course', $course);
}
} else {
return Redirect::to('/');
}
} else {
return View::make('product.list')->with('found', false)->with('course', $course);
}
} else {
return Redirect::to('/');
}
}
示例11: showDashboard
public function showDashboard()
{
$menu = '';
$_301 = Issue::where('generation_id', '=', 1)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_201 = Issue::where('generation_id', '=', 2)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_101 = Issue::where('generation_id', '=', 3)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_302 = Issue::where('generation_id', '=', 4)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_202 = Issue::where('generation_id', '=', 5)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_102 = Issue::where('generation_id', '=', 6)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_603 = Issue::where('generation_id', '=', 7)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_503 = Issue::where('generation_id', '=', 8)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$_403 = Issue::where('generation_id', '=', 9)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
$last_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '<>', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count();
$curr_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '=', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count();
$movement_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 10)->count();
$curr_active_students = Placement::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('active', '=', 1)->count();
$curr_do_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 13)->count();
$curr_resign_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 14)->count();
$curr_relocate_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 15)->count();
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
return View::make('dashboard.home', compact('_301', '_201', '_101', '_302', '_202', '_102', '_603', '_503', '_403', 'last_month_registrations', 'curr_month_registrations', 'movement_registrations', 'curr_active_students', 'curr_do_students', 'curr_resign_students', 'curr_relocate_students', 'courses', 'menu'));
}
示例12: english_language
public function english_language()
{
$pageTitle = "English Language | excellence in the training & consultancy services in UK ";
$data = Course::where('type', 'english-language')->latest('id')->get();
return View::make('pages.english_language', compact('pageTitle', 'data'));
}
示例13: getCourses
/**
* get full course list with user enroll info
*
* @param string $email
* @return Response
*/
public static function getCourses($idUser)
{
$app = \Slim\Slim::getInstance();
if (!User::find($idUser)) {
$app->response->setStatus(400);
return "User does not exist";
}
$courses = Course::where('isPublished', 1)->get();
foreach ($courses as &$value) {
unset($value->isPublished);
$enrollment = User::find($idUser)->enrollment()->where('course_id', $value->id)->first();
unset($enrollment->user_id);
unset($enrollment->course_id);
$value->enrollment = $enrollment;
$value->saved = MyCourses::where('user_id', $idUser)->where('course_id', $value->id)->count();
//$value->info = Course::find($value->idCourse);
}
return json_encode($courses);
}
示例14: getProgram
public function getProgram($id)
{
$program = Course::where('id', '=', $id)->get();
return json_encode($program);
}
示例15: unserialize
<a class="navbar-brand" href="{{ URL::to('') }}">{{ Config::get('app.projectname') }}</a>
</div>
<div class="collapse navbar-collapse" id="appnav">
<ul class="nav navbar-nav">
@if(Auth::check())
<li><a href="{{ URL::to('') }}">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Courses <span class="fa fa-angle-down"></span></a>
<ul class="dropdown-menu" role="menu">
<?php
$mycourses = unserialize(Auth::user()->courseids);
?>
@forelse($mycourses as $course)
<?php
$courseinfo = Course::where('uid', '=', $course)->first();
?>
<li><a href="{{ URL::to('c/' . $course) }}">{{ $course }}: {{ $courseinfo->name }}</a></li>
@empty
<li><a><i>No Courses Found!</i></a></li>
@endforelse
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Groups <span class="fa fa-angle-down"></span></a>
<ul class="dropdown-menu" role="menu">
<?php
$allgroups = Group::all();
?>
@forelse($allgroups as $g)
<?php