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


PHP Teacher::where方法代码示例

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


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

示例1: showDashboard

 public function showDashboard()
 {
     $data = [];
     $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;
     //Cards value
     $data['students'] = Student::where('collegeid', '=', $collegeid)->count();
     $data['teachers'] = Teacher::where('collegeid', '=', $collegeid)->count();
     $data['subjects'] = Subject::where('collegeid', '=', $collegeid)->count();
     $data['parents'] = $data['students'] * 2;
     return View::make('pages.dashboard', array('data' => $data, 'flag' => $flag));
 }
开发者ID:pankaja455,项目名称:WebSchool,代码行数:31,代码来源:HomeController.php

示例2: caculate

 /**
  * 計算課表
  */
 public static function caculate($param)
 {
     // 設定執行時間
     set_time_limit(60);
     // 產生教室使用時間,提供排課使用
     $classroom = Classroom::all();
     foreach ($classroom as $classroomItem) {
         $GLOBALS['classroomCourseTime'][$classroomItem->classroom_id] = str_replace('1', $classroomItem->count, $classroomItem->course_time);
     }
     // 取得教師排課需求,計算適應值用
     $teacher = Teacher::where('course_time', '<>', str_repeat(0, 35))->get();
     foreach ($teacher as $teacherItem) {
         $GLOBALS['teacherRequire'][$teacherItem->teacher_id]['require'] = $teacherItem->course_time;
         $GLOBALS['teacherRequire'][$teacherItem->teacher_id]['classes_id'] = $teacherItem->classes_id;
         if ($teacherItem->classes_id != 0) {
             $GLOBALS['teacherRequire'][$teacherItem->teacher_id]['courseTime'] = $teacherItem->classes->year->course_time;
         }
     }
     // 產生課表,速度、計算適應值
     $seed = self::_generateSeed($param['seedCount']);
     // 發生錯誤,回傳錯誤結果
     if ($seed[0] == 'error') {
         return $seed;
     }
     // 進行粒子最佳化計算
     $seedProgressHistory = array();
     $extinctionTimes = 1;
     while ($param['extinctionCount'] > 0) {
         $withoutProgressCount = 0;
         $bestSeed = self::_getBestSeed($seed);
         $seedProgressHistory[] = number_format($bestSeed['fitness'], 2, '.', '');
         while ($withoutProgressCount < $param['executeCount']) {
             // 更新種子速度
             self::_updateSeedV($seed, $bestSeed);
             // 依照速度更新課表排課、計算適應值
             $seed = self::_updateSeed($seed);
             // 取得新的全域最佳值
             $newBestSeed = self::_getBestSeed($seed);
             // 判斷是否改進
             if ($bestSeed['fitness'] < $newBestSeed['fitness']) {
                 $bestSeed = $newBestSeed;
                 $withoutProgressCount = 0;
                 $seedProgressHistory[] = number_format($bestSeed['fitness'], 2, '.', '') . '<sup class="progross">&nbsp;&nbsp;改進</sup>';
             } else {
                 $withoutProgressCount++;
                 $seedProgressHistory[] = number_format($bestSeed['fitness'], 2, '.', '');
             }
         }
         // 進行判斷是否改進毀滅結果
         if (!isset($historyBestSeed) || $historyBestSeed['fitness'] < $bestSeed['fitness']) {
             $historyBestSeed = $bestSeed;
         }
         $seedProgressHistory[] = '<strong>' . number_format($historyBestSeed['fitness'], 2, '.', '') . '<sup>&nbsp;&nbsp;全域最佳</sup></strong>';
         $seedProgressHistory[] = 'Extinction ' . $extinctionTimes;
         $param['extinctionCount']--;
         $extinctionTimes++;
     }
     file_put_contents(storage_path() . '\\result.json', json_encode($historyBestSeed['timetable']));
     return $seedProgressHistory;
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:63,代码来源:Courseunit.php

示例3: syncTeacher

 /**
  * 同步更新教師的班級資料
  */
 public static function syncTeacher()
 {
     $classes = Classes::find(self::$lastClassesId);
     try {
         $teacher = Teacher::where('classes_id', '=', $classes->classes_id)->update(array('classes_id' => 0));
         if ($classes->teacher_id > 0) {
             $teacher = Teacher::find($classes->teacher_id)->update(array('classes_id' => $classes->classes_id));
         }
     } catch (Exception $e) {
     }
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:14,代码来源:Classes.php

示例4: index

 public function index()
 {
     $id = Auth::id();
     $student = Student::where('id_user', '=', $id)->get()->first();
     $teacher = Teacher::where('id_user', '=', $id)->get()->first();
     if (isset($student)) {
         return View::make('users.hello', compact('student'));
         //
     } else {
         if (isset($teacher)) {
             return View::make('users.hello', compact('teacher'));
             //
         }
     }
 }
开发者ID:ReyesPedro,项目名称:PlataformaPreguntas,代码行数:15,代码来源:HomeController.php

示例5: store

 public function store()
 {
     $title = Input::get('title');
     $score = Input::get('minimunScore');
     $numberOfquestions = Input::get('numberQuestions');
     $Creator = Teacher::where('id_user', '=', Auth::id())->get()->first();
     $exam = new Exam();
     $exam->title = $title;
     $exam->creator = $Creator->id;
     $exam->score = $score;
     $exam->save();
     $ex = Exam::where('title', '=', $title)->get()->first();
     $id = $ex->id;
     return View::make('questions.create', compact('id', 'numberOfquestions'));
 }
开发者ID:ReyesPedro,项目名称:PlataformaPreguntas,代码行数:15,代码来源:ExamsController.php

示例6: run

 public function run()
 {
     //DB::table('exams')->delete();
     $teacher = Teacher::where('first_name', '=', 'Luis')->get()->first();
     $exam = new Exam();
     $exam->title = 'Sumas basicas';
     $exam->creator = $teacher->id;
     $exam->score = 2;
     $exam->save();
     $teacher2 = Teacher::where('first_name', '=', 'Luis')->get()->first();
     $exam2 = new Exam();
     $exam2->title = 'Restas basicas';
     $exam2->creator = $teacher2->id;
     $exam2->score = 2;
     $exam2->save();
 }
开发者ID:ReyesPedro,项目名称:PlataformaPreguntas,代码行数:16,代码来源:ExamsSeeder.php

示例7: function

     return View::make('timetable')->with($viewData);
 });
 // 顯示教師排課清單
 Route::get('view_title/{titleId}/{teacherId}', function ($titleId, $teacherId) {
     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     return View::make('timetable')->with($viewData);
 });
 // 顯示教師排課編輯畫面
 Route::get('view_title/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     $viewData['courseUnit'] = Courseunit::find($courseUnitId);
     return View::make('timetable')->with($viewData);
 });
 // 執行更新排課設定
 Route::post('edit/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     // 設定為編輯模式,方便驗證功能
     $validator = FormValidator::courseUnit(array_merge(Input::all(), array('mode' => 'edit' . $courseUnitId)));
     if ($validator->fails()) {
         return Redirect::to('/timetable/view_title/' . $titleId . '/' . $teacherId . '/' . $courseUnitId)->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:31,代码来源:routes.php

示例8: authenticate_teacher_login

 /**
  * Performs teacher account authentification and returns boolean information about success.
  * @param string $eamil teacher account e-mail address.
  * @param string $password teacher account password in plain text form.
  * @return boolean TRUE, if teacher authentification is successful, FALSE otherwise (i.e. bad e-mail of password).
  */
 public function authenticate_teacher_login($email, $password)
 {
     $teacher = new Teacher();
     $teacher->where('email', $email);
     $teacher->where('password', sha1($password));
     $teacher->get();
     if ($teacher->exists()) {
         $userdata = $teacher->to_array();
         unset($userdata['password']);
         unset($userdata['created']);
         unset($userdata['updated']);
         $this->CI->session->set_userdata(SESSION_AUTH_LOGIN_TEACHER, $userdata);
         $this->validate_teacher_login_verification(TRUE);
         return TRUE;
     } else {
         $this->validate_teacher_login_verification(FALSE);
         $this->add_login_failed_record($email, self::ACCOUNT_TYPE_TEACHER);
         return FALSE;
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:26,代码来源:usermanager.php

示例9: drop

 /**
  * Remove the subjects of an University
  * 
  * @return JSON Ajax
  */
 public function drop()
 {
     if (Request::ajax()) {
         $subject = Subject::find(Input::get('subject_id'));
         foreach (Teacher::where('university_id', Auth::id())->get() as $teacher) {
             if ($teacher->whereIn('subjects_id', array(new MongoId($subject->_id)))->count() > 0) {
                 return Response::json(Lang::get('add_subject.subject_used'));
             }
         }
         $subject->delete();
         return Response::json($subject->trashed() ? "00" : "99");
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:18,代码来源:SubjectController.php

示例10: search_teachers

 public function search_teachers()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_listar_profesores', $data["actions"])) {
             $data["search"] = Input::get('search');
             $search_criteria = $data["search"];
             $data["teachers_data"] = Teacher::where('names', 'LIKE', "%{$search_criteria}%")->orWhere('lastname', 'LIKE', "%{$search_criteria}%")->whereNull('deleted_at')->orderBy('lastname')->paginate(20);
             return View::make('people/list_teachers', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }
开发者ID:damv93,项目名称:trecedemayolaravel,代码行数:22,代码来源:PeopleController.php

示例11: delete

 /**
  * 刪除職稱會讓該職稱教師title_id設定為0
  */
 public function delete()
 {
     $classes = Teacher::where('title_id', '=', $this->title_id)->update(array('title_id' => 0));
     parent::delete();
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:8,代码来源:Title.php

示例12: delete_teacher

 public function delete_teacher()
 {
     $this->output->set_content_type('application/json');
     $this->usermanager->teacher_login_protected_redirect();
     $url = $this->uri->ruri_to_assoc(3);
     $teacher_id = isset($url['teacher_id']) ? intval($url['teacher_id']) : 0;
     if ($teacher_id != 0) {
         $this->_transaction_isolation();
         $this->db->trans_begin();
         $teacher = new Teacher();
         $teacher->where('id !=', $this->usermanager->get_teacher_id())->get_by_id($teacher_id);
         $teacher->delete();
         if ($this->db->trans_status()) {
             $this->db->trans_commit();
             $this->output->set_output(json_encode(TRUE));
             $this->_action_success();
         } else {
             $this->db->trans_rollback();
             $this->output->set_output(json_encode(FALSE));
         }
     } else {
         $this->output->set_output(json_encode(FALSE));
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:24,代码来源:teachers.php

示例13: find

 /**
  * Function that return a teacher information array
  *
  * @return Array
  */
 public function find()
 {
     if (Request::ajax()) {
         $teacher = Teacher::where('email', Input::get('email'))->first();
         return Response::json($teacher);
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:12,代码来源:TeacherController.php


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