本文整理汇总了PHP中Classes::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::where方法的具体用法?PHP Classes::where怎么用?PHP Classes::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showParent
public function showParent()
{
$data = array();
$loginid = Session::get('user')->id;
$collegeid = Session::get('user')->collegeid;
$flag = Session::get('user')->flag;
$tb = "";
if ($flag == 1) {
$tb = "Admin";
} else {
if ($flag == 2) {
$tb = "Teacher";
} else {
if ($flag == 3) {
$tb = "Student";
} else {
$tb = "Staff";
}
}
}
$dt = $tb::where('loginid', '=', $loginid)->first();
$data['name'] = $dt->name;
$data['pic'] = $dt->profilepic;
$data['id'] = $loginid;
$colid = Session::get('user')->collegeid;
//$colid = "bt123";
$classes = Classes::where('collegeid', '=', $colid)->get();
$data['class'] = [];
$i = 0;
for ($i = 0; $i < sizeof($classes); $i++) {
$data['class'][$i]['id'] = $classes[$i]->id;
$data['class'][$i]['name'] = $classes[$i]->classname;
}
return View::make('pages.parent', array('data' => $data, 'flag' => $flag));
}
示例2: postGetClassesFromStreamId
/**
* Api for getting Classes by Stream Id
*/
public function postGetClassesFromStreamId()
{
$stream_id = Input::get('stream_id');
$school_id = Sentry::getUser()->school_id;
$classes = Classes::where('streams_id', '=', $stream_id)->where('school_id', '=', $school_id)->get();
$response = array('status' => 'success', 'result' => array('classes' => $classes));
return Response::json($response);
}
示例3: syncClasses
public static function syncClasses()
{
$teacher = Teacher::find(self::$lastTeacherId);
try {
$classes = Classes::where('teacher_id', '=', $teacher->teacher_id)->update(array('teacher_id' => 0));
if ($teacher->classes_id > 0) {
$classes = Classes::find($teacher->classes_id)->update(array('teacher_id' => $teacher->teacher_id));
}
} catch (Exception $e) {
}
}
示例4: getclass
public function getclass()
{
return \Classes::where('collegeid', '=', Auth::user()->collegeid)->lists('classname', 'id');
}
示例5: updateElective
/**
* Function that updates a module
*/
protected function updateElective($id, $d, $expected)
{
$data = '';
foreach ($d as $key => $value) {
$data = $data . $key . '=' . $value . '&';
}
$response = $this->call('POST', '/elective-change', ['elecData' => $data]);
$json = json_decode($response->getContent());
if ($expected) {
$this->assertEquals(true, $json->success);
// Get the module we just updated.
$c = Classes::where('classid', $id)->first();
// Now return the class.
return $c;
} else {
$this->assertEquals(true, $json->fail);
}
}
示例6: date
<!-- End of Filtering system -->
</section>
<!-- /portfolio -->
<?php
// Let's define what semester we are in.
$today = date('Y-m-d');
$semester = date('Y-m-d', strtotime(date('Y', strtotime($today)) . '-06-01'));
// If current date is greater than semester 2
// Change current to semester 1.
if ($today > $semester) {
// Get next year.
$year = date('Y', strtotime(date("Y-m-d", time()) . " + 365 day"));
$semester = date('Y-m-d', strtotime($year . '-01-01'));
}
// Get the number of classes so we can display it.
$classes = Classes::where('classlecturer', Auth::user()->id)->get();
$total = 0;
foreach ($classes as $c) {
// Check if this class belongs to this year.
if (date('Y', strtotime($c->created)) === date('Y', strtotime($today))) {
// Now check that it is part of this semester.
if (date('Y-m-d', strtotime($c->created)) < $semester) {
$total++;
}
}
}
?>
<section class="section">
<div class="container">
<h1 class="h1">Profile</h1>
<div class="row">
示例7: removeLecturer
/**
* Function that deletes a specific lecturer.
*/
public function removeLecturer()
{
// Load the lecturer to delete.
$lecturer = User::find(Input::get('id'));
// Verify that there are no classes under lecturer.
$classes = Classes::where('classlecturer', Input::get('id'))->get();
if (count($classes) > 0) {
// Inform user that lecturer still has classes assigned.
return Response::json(array('success' => false, 'errors' => 'Lecturer still has classes assigned!'));
}
// Delete lecturer.
$lecturer->delete();
// Return successful response to user.
return Response::json(array('success' => true));
}
示例8: printOrder
public function printOrder($orderid)
{
$id = Crypt::decrypt($orderid);
$orders = Orders::with('Customers', 'Students', 'StudentClasses')->where('id', '=', $id)->get();
$orders = $orders['0'];
$paymentDues = PaymentDues::where('id', '=', $orders->payment_dues_id)->get();
$batchDetails = Batches::where('id', '=', $orders->StudentClasses->batch_id)->get();
$class = Classes::where('id', '=', $orders->StudentClasses->class_id)->where('franchisee_id', '=', Session::get('franchiseId'))->first();
$customerMembership = CustomerMembership::getCustomerMembership($orders->customer_id);
/* echo "<pre>";
print_r($paymentDues);
exit(); */
$data = compact('orders', 'class', 'paymentDues', 'batchDetails', 'customerMembership');
//$data = compact('orders','class');
return View::make('pages.orders.printorder', $data);
}
示例9: enrollKid
public function enrollKid()
{
$inputs = Input::all();
$batch_data = Batches::find($inputs['batchCbx']);
$eachClassCost = $batch_data->class_amount;
//return Response::json(array('status'=>$inputs));
//$inputs['discountPercentage']=$inputs['discountP'];
$studentClasses['classId'] = $inputs['eligibleClassesCbx'];
$studentClasses['batchId'] = $inputs['batchCbx'];
$studentClasses['studentId'] = $inputs['studentId'];
$season_data = Seasons::find($inputs['SeasonsCbx']);
//$inputs['enrollmentEndDate']=$season_data->end_date;
//$studentClasses['enrollment_start_date'] = date('Y-m-d', strtotime($inputs['enrollmentStartDate']));
//return Response::json(array('status'=>'working'));
//$studentClasses['enrollment_end_date'] = date('Y-m-d', strtotime($inputs['enrollmentEndDate']));
$studentClasses['selected_sessions'] = $inputs['selectedSessions'];
$studentClasses['seasonId'] = $inputs['SeasonsCbx'];
//for proper enrollment start date and end date
$end = Carbon::now();
$start = Carbon::now();
$start->year = date('Y', strtotime($inputs['enrollmentStartDate']));
$start->month = date('m', strtotime($inputs['enrollmentStartDate']));
$start->day = date('d', strtotime($inputs['enrollmentStartDate']));
$end->year = date('Y', strtotime($inputs['enrollmentEndDate']));
$end->month = date('m', strtotime($inputs['enrollmentEndDate']));
$end->day = date('d', strtotime($inputs['enrollmentEndDate']));
$batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $start->toDateString())->where('schedule_date', '<=', $end->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
$studentClasses['enrollment_start_date'] = $batch_data[0]['schedule_date'];
$studentClasses['enrollment_end_date'] = $batch_data[count($batch_data) - 1]['schedule_date'];
//Batch Start date
$BatchDetails = Batches::where('id', '=', $inputs['batchCbx'])->first();
$reminderStartDate = $BatchDetails->start_date;
$enrollment = StudentClasses::addStudentClass($studentClasses);
$paymentDuesInput['student_id'] = $inputs['studentId'];
$paymentDuesInput['customer_id'] = $inputs['customerId'];
$paymentDuesInput['batch_id'] = $inputs['batchCbx'];
$paymentDuesInput['class_id'] = $inputs['eligibleClassesCbx'];
$paymentDuesInput['selected_sessions'] = $inputs['selectedSessions'];
$paymentDuesInput['seasonId'] = $inputs['SeasonsCbx'];
$paymentDuesInput['each_class_cost'] = $eachClassCost;
$order['customer_id'] = $inputs['customerId'];
$order['student_id'] = $inputs['studentId'];
$order['seasonId'] = $inputs['SeasonsCbx'];
$order['student_classes_id'] = $enrollment->id;
$order['payment_mode'] = $inputs['paymentTypeRadio'];
$order['payment_for'] = "enrollment";
$order['card_last_digit'] = $inputs['card4digits'];
$order['card_type'] = $inputs['cardType'];
$order['bank_name'] = $inputs['bankName'];
$order['cheque_number'] = $inputs['chequeNumber'];
//$order['each_class_cost'] =$eachClassCost;
if (isset($inputs['membershipType'])) {
$order['membershipType'] = $inputs['membershipType'];
}
$paydue_id;
if ($inputs['paymentOptionsRadio'] == 'singlepay') {
// for starting and end date of enrollment
$enddate = Carbon::now();
$startdate = Carbon::now();
$startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
$startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
$startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
$enddate->year = date('Y', strtotime($inputs['enrollmentEndDate']));
$enddate->month = date('m', strtotime($inputs['enrollmentEndDate']));
$enddate->day = date('d', strtotime($inputs['enrollmentEndDate']));
$batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('schedule_date', '<=', $enddate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
$paymentDuesInput['start_order_date'] = $batch_data[0]['schedule_date'];
$paymentDuesInput['end_order_date'] = $batch_data[count($batch_data) - 1]['schedule_date'];
$paymentDuesInput['payment_due_amount'] = $inputs['singlePayAmount'];
$paymentDuesInput['payment_type'] = $inputs['paymentOptionsRadio'];
$paymentDuesInput['payment_status'] = "paid";
$paymentDuesInput['discount_applied'] = $inputs['discountPercentage'];
$paymentDuesInput['student_class_id'] = $enrollment->id;
$paymentDuesInput['selected_order_sessions'] = $inputs['selectedSessions'];
//$paymentDuesInput['start_order_date']=$studentClasses['enrollment_start_date'];
//$paymentDuesInput['end_order_date']=$studentClasses['enrollment_end_date'];
$paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['singlePayAmount'];
$order['amount'] = $inputs['singlePayAmount'];
if ($inputs['CustomerType'] == 'OldCustomer') {
$paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate']));
$order['created_at'] = $paymentDuesInput['created_at'];
}
$paymentDuesResult = PaymentDues::createPaymentDues($paymentDuesInput);
$order['payment_dues_id'] = $paymentDuesResult->id;
$order['order_status'] = "completed";
if ($inputs['selectedSessions'] > 8) {
// creating followup for the single pay
$presentDate = Carbon::now();
$startdate = Carbon::now();
$startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
$startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
$startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
$batch_schedule_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
$session_number = (int) ($inputs['selectedSessions'] / 2);
$reminder_date = $batch_schedule_data[$session_number]['schedule_date'];
$customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
$customer_log_data['student_id'] = $paymentDuesResult->student_id;
$customer_log_data['franchisee_id'] = Session::get('franchiseId');
$customer_log_data['followup_type'] = 'PAYMENT';
$customer_log_data['followup_status'] = 'REMINDER_CALL';
//.........这里部分代码省略.........
示例10: printClassList
function printClassList($classId)
{
if (Classes::where('classid', $classId)->count()) {
$class = Classes::where('classid', $classId)->first();
if ($class->classlecturer != Auth::user()->id) {
return;
}
$filename = Modules::where('mid', $class->classmodule)->first()->mcode . "Elec" . $classId . "List.csv";
$delimiter = ",";
header('Content-Type: application/csv');
header('Content-Disposition: attachement; filename="' . $filename . '";');
$array = array();
array_push($array, array('Student ID' => 'Student ID', 'Name' => 'Student Name'));
foreach (json_decode($class->classstudents) as $student) {
$studentarray = array('Student Id' => User::find($student)->username, 'Name' => User::find($student)->name);
array_push($array, $studentarray);
}
$f = fopen('php://output', 'w');
foreach ($array as $line) {
fputcsv($f, $line, $delimiter);
}
}
}
示例11: delete
/**
* 刪除年級會連帶刪除底下的年級
*/
public function delete()
{
Classes::where('year_id', '=', $this->year_id)->delete();
return parent::delete();
}
示例12: date
<?php
// Let's define what semester we are in.
$today = date('Y-m-d');
$semester = date('Y-m-d', strtotime(date('Y', strtotime($today)) . '-06-01'));
// If current date is greater than semester 2
// Change current to semester 1.
if ($today > $semester) {
// Get next year.
$year = date('Y', strtotime(date("Y-m-d", time()) . " + 365 day"));
$semester = date('Y-m-d', strtotime($year . '-01-01'));
}
// Let's get the total students and total limit of elective.
$totalStudents = 0;
$totalLimit = 0;
// Get all classes of current elective.
$classes = Classes::where('classmodule', $module->mid)->get();
foreach ($classes as $c) {
// Check if this class belongs to this year.
if (date('Y', strtotime($c->created)) === date('Y', strtotime($today))) {
// Now check that it is part of this semester.
if (date('Y-m-d', strtotime($c->created)) < $semester) {
$totalStudents += $c->classcurrent;
$totalLimit += $c->classlimit;
}
}
}
// Define total requested.
$totalRequested = count(json_decode($module->mrequests));
?>
<h3>{{ $module->mshorttitle }}</h3>
<p>Total Classes: {{ count($classes) }}</p>
示例13: postGetClassStreamPair
public function postGetClassStreamPair()
{
$classes = Classes::where('school_id', '=', $this->getSchoolId())->orderBy('class', 'asc')->get();
$i = 0;
$stream_Class_Pairs = array();
foreach ($classes as $class => $value) {
$stream = Streams::find($classes[$class]['streams_id']);
$stream_Class_Pairs[$i] = array('classes_id' => $classes[$class]['id'], 'streams_id' => $classes[$class]['streams_id'], 'stream_class_pair' => $classes[$class]['class'] . " (" . $stream->stream_name . ")");
$i++;
}
$response = array('status' => 'success', 'result' => array('stream_class_pairs' => $stream_Class_Pairs));
return Response::json($response);
}
示例14: postElectiveChange
public function postElectiveChange()
{
$inputData = Input::get('elecData');
parse_str($inputData, $formFields);
$moduleData = array('classlecturer' => User::where('name', $formFields['classlecturer'])->first()->id, 'classmodule' => $formFields['classmodule'], 'classlimit' => $formFields['classlimit']);
Validator::extend('ranked', function ($attribute, $value, $parameters) {
// This is the correct way to do this.
$coord = User::find($value);
if ($coord && $coord->rank < 1) {
return false;
}
return true;
});
Validator::extend('indep', function ($attribute, $value, $parameters) {
// This is the correct way to do this.
$mod = Modules::find($value);
if ($mod && $mod->departmentid !== Auth::user()->department) {
return false;
}
return true;
});
$rules = array('classmodule' => 'required|exists:modules,mid|indep', 'classlecturer' => 'required|exists:users,id|ranked', 'classlimit' => 'required|integer|between:5,30');
$messages = ['ranked' => "This user can't coordinate this class.", 'indep' => "This module is not in your department."];
$validator = Validator::make($moduleData, $rules, $messages);
if ($validator->fails()) {
return Response::json(array('fail' => true, 'errors' => $validator->getMessageBag()->toArray()));
} else {
$elec = Classes::where('classid', $formFields['classid'])->first();
$elec->classmodule = $moduleData['classmodule'];
$elec->classlecturer = $moduleData['classlecturer'];
$elec->classlimit = $moduleData['classlimit'];
if ($elec->save()) {
Session::flash('global', 'You have edited a module.');
//return success message
return Response::json(array('success' => true, 'mName' => Modules::find($moduleData['classmodule'])->mshorttitle));
}
}
}
示例15: getAllClassesForFranchise
static function getAllClassesForFranchise()
{
return Classes::where('franchisee_id', '=', Session::get('franchiseId'))->get();
}